setByteArray(): avoid potential signed integer overflow. Pointed by Hendra Gunadi. No actual problem known (which does not mean there wouldn't be any. Particularly on 32bit builds)
This commit is contained in:
parent
4bb584a35f
commit
1302ffb350
@ -46,8 +46,8 @@ setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
|
||||
*vpp = 0;
|
||||
}
|
||||
if (vp) {
|
||||
tmsize_t bytes = (tmsize_t)(nmemb * elem_size);
|
||||
if (elem_size && bytes / elem_size == nmemb)
|
||||
tmsize_t bytes = _TIFFMultiplySSize(NULL, nmemb, elem_size, NULL);
|
||||
if (elem_size)
|
||||
*vpp = (void*) _TIFFmalloc(bytes);
|
||||
if (*vpp)
|
||||
_TIFFmemcpy(*vpp, vp, bytes);
|
||||
|
Loading…
Reference in New Issue
Block a user