Lei Zhang | b8c253a | 2022-06-10 22:17:42 +0000 | [diff] [blame] | 1 | diff --git a/third_party/libopenjpeg/tcd.c b/third_party/libopenjpeg/tcd.c |
Daniel Hosseinian | a81ff72 | 2021-02-17 20:56:08 +0000 | [diff] [blame] | 2 | index 6442669d6..4c728d4c6 100644 |
Lei Zhang | b8c253a | 2022-06-10 22:17:42 +0000 | [diff] [blame] | 3 | --- a/third_party/libopenjpeg/tcd.c |
| 4 | +++ b/third_party/libopenjpeg/tcd.c |
Daniel Hosseinian | a81ff72 | 2021-02-17 20:56:08 +0000 | [diff] [blame] | 5 | @@ -819,6 +819,11 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, |
Nicolas Pena | 826480c | 2017-10-23 10:30:46 -0400 | [diff] [blame] | 6 | if (isEncoder) { |
| 7 | OPJ_SIZE_T l_tile_data_size; |
| 8 | |
| 9 | + if (l_tilec->x0 >= l_tilec->x1 || l_tilec->y0 >= l_tilec->y1) { |
| 10 | + opj_event_msg(manager, EVT_ERROR, "Invalid tile data\n"); |
| 11 | + return OPJ_FALSE; |
| 12 | + } |
| 13 | + |
| 14 | /* compute l_data_size with overflow check */ |
| 15 | OPJ_SIZE_T w = (OPJ_SIZE_T)(l_tilec->x1 - l_tilec->x0); |
| 16 | OPJ_SIZE_T h = (OPJ_SIZE_T)(l_tilec->y1 - l_tilec->y0); |