diff --git a/src/libImaging/BcnEncode.c b/src/libImaging/BcnEncode.c index f6445d653..7a5072dde 100644 --- a/src/libImaging/BcnEncode.c +++ b/src/libImaging/BcnEncode.c @@ -258,7 +258,8 @@ ImagingBcnEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) { UINT8 *dst = buf; for (;;) { - if (dst + 8 >= bytes + buf) { + // Loop writes a max of 16 bytes per iteration + if (dst + 16 >= bytes + buf) { break; } if (n == 5) {