Skip to content

Commit 11a1d41

Browse files
committed
better size checks for gzip & lz4
1 parent c1d6732 commit 11a1d41

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

c/fasl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,11 @@ static ptr fasl_entry(ptr tc, IFASLCODE situation, faslFile f, ptr externals) {
461461
case fasl_type_lz4: {
462462
ptr result; INT bytes_consumed;
463463
iptr dest_size = S_fasl_uptrin(f, &bytes_consumed);
464-
if ((uptr)dest_size > (uptr)most_positive_fixnum)
465-
toolarge(f->uf.path);
466464
iptr src_size = size - (2 + bytes_consumed); /* adjust for u8 compression type, u8 fasl type, and uptr dest_size */
467465

466+
if ((uptr)src_size > (uptr)maximum_bytevector_length ||
467+
(uptr)dest_size > (uptr)maximum_bytevector_length)
468+
toolarge(f->uf.path);
468469
PREPARE_BYTEVECTOR(SRCBV(tc), src_size);
469470
PREPARE_BYTEVECTOR(DSTBV(tc), dest_size);
470471
S_fasl_bytesin(&BVIT(SRCBV(tc),0), src_size, f);

0 commit comments

Comments
 (0)