Home | History | Annotate | Download | only in libopenjpeg20
      1 diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c
      2 index ad6e1b86f..bf1cb4f36 100644
      3 --- a/third_party/libopenjpeg20/j2k.c
      4 +++ b/third_party/libopenjpeg20/j2k.c
      5 @@ -9086,6 +9086,12 @@ static OPJ_BOOL opj_j2k_update_image_data(opj_tcd_t * p_tcd,
      6           * */
      7          assert(res_x0 >= 0);
      8          assert(res_x1 >= 0);
      9 +
     10 +        /* Prevent bad casting to unsigned values in the subsequent lines. */
     11 +        if ( res_x0 < 0 || res_x1 < 0 || res_y0 < 0 || res_y1 < 0 ) {
     12 +            return OPJ_FALSE;
     13 +        }
     14 +
     15          if (l_x0_dest < (OPJ_UINT32)res_x0) {
     16              l_start_x_dest = (OPJ_UINT32)res_x0 - l_x0_dest;
     17              l_offset_x0_src = 0;
     18