tif_jpeg.c: avoid potential division in previous fix (master only)

This commit is contained in:
Even Rouault 2020-04-27 13:20:55 +02:00
parent c96a0232b7
commit 8405704ebb
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D

View File

@ -1212,11 +1212,14 @@ JPEGPreDecode(TIFF* tif, uint16 s)
for (ci = 0; ci < sp->cinfo.d.num_components; ci++) {
const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
if( compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0 )
{
nRequiredMemory += (toff_t)(
((compptr->width_in_blocks + compptr->h_samp_factor - 1) / compptr->h_samp_factor)) *
((compptr->height_in_blocks + compptr->v_samp_factor - 1) / compptr->v_samp_factor) *
sizeof(JBLOCK);
}
}
if( sp->cinfo.d.mem->max_memory_to_use > 0 &&
nRequiredMemory > (toff_t)(sp->cinfo.d.mem->max_memory_to_use) &&