| diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c |
| index 626409058..e72cc0be9 100644 |
| --- a/third_party/libtiff/tif_pixarlog.c |
| +++ b/third_party/libtiff/tif_pixarlog.c |
| @@ -799,7 +799,7 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) |
| return (0); |
| } |
| /* Check that we will not fill more than what was allocated */ |
| - if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size) |
| + if (sp->tbuf_size < 0 || sp->stream.avail_out > (uInt) sp->tbuf_size) |
| { |
| TIFFErrorExt(tif->tif_clientdata, module, "sp->stream.avail_out > sp->tbuf_size"); |
| return (0); |