diff options
| author | szukw000 <szukw000@arcor.de> | 2020-06-10 17:40:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-10 17:40:50 +0200 |
| commit | 25fb144c42f97489594302e1e6ff886791e0a5b3 (patch) | |
| tree | 0c3c244923a09cda8dfbeec7d167f10c66821504 /src | |
| parent | 19ef7f26c43f689b627aad642da7f6150893b863 (diff) | |
Testing for invalid values of width, height, numcomps (#1254)
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/openjp2/jp2.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 4809e348..7c065ba7 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -586,6 +586,12 @@ static OPJ_BOOL opj_jp2_read_ihdr(opj_jp2_t *jp2, opj_read_bytes(p_image_header_data, &(jp2->numcomps), 2); /* NC */ p_image_header_data += 2; + if (jp2->h < 1 || jp2->w < 1 || jp2->numcomps < 1) { + opj_event_msg(p_manager, EVT_ERROR, + "Wrong values for: w(%d) h(%d) numcomps(%d) (ihdr)\n", + jp2->w, jp2->h, jp2->numcomps); + return OPJ_FALSE; + } if ((jp2->numcomps - 1U) >= 16384U) { /* unsigned underflow is well defined: 1U <= jp2->numcomps <= 16384U */ opj_event_msg(p_manager, EVT_ERROR, "Invalid number of components (ihdr)\n"); |
