You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In j2k.c, there are places where the uint version should be used instead of using the int version while casting the parameters to int and casting back the result to uint. For example:
l_cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(l_image->x1 - l_cp->tx0), (OPJ_INT32)l_cp->tdx);
should be
l_cp->tw = opj_uint_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
This will prevent certain overflows because some of these values are read from file, and if they are big, the sum will overflow. See suggested fixes at: https://pdfium-review.googlesource.com/c/2352/
The text was updated successfully, but these errors were encountered:
So, does anyone know why if a, b, c are OPJ_UINT32, we try doing something like: a = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)b, (OPJ_INT32)c);?
I think it is reasonable to change that to: a = opj_uint_ceildiv(b, c);
In j2k.c, there are places where the uint version should be used instead of using the int version while casting the parameters to int and casting back the result to uint. For example:
l_cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(l_image->x1 - l_cp->tx0), (OPJ_INT32)l_cp->tdx);
should be
l_cp->tw = opj_uint_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
This will prevent certain overflows because some of these values are read from file, and if they are big, the sum will overflow. See suggested fixes at:
https://pdfium-review.googlesource.com/c/2352/
The text was updated successfully, but these errors were encountered: