diff options
| author | Young_X <YangX92@hotmail.com> | 2018-11-23 17:12:06 +0800 |
|---|---|---|
| committer | Young Xiao <YangX92@hotmail.com> | 2018-11-28 14:39:14 +0800 |
| commit | ce9583d1d7627e007a34a31ae4e22a00d78bd153 (patch) | |
| tree | a12511bf7bcd2fcb67cebf2cc5c12aa3596bd664 /src | |
| parent | c58df149900df862806d0e892859b41115875845 (diff) | |
[JPWL] opj_compress: reorder checks related to code block dimensions to avoid potential int overflow
Signed-off-by: Young_X <YangX92@hotmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/jpwl/opj_jpwl_compress.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/jpwl/opj_jpwl_compress.c b/src/bin/jpwl/opj_jpwl_compress.c index 28f0670c..c17486a0 100644 --- a/src/bin/jpwl/opj_jpwl_compress.c +++ b/src/bin/jpwl/opj_jpwl_compress.c @@ -952,8 +952,9 @@ static int parse_cmdline_encoder(int argc, char **argv, case 'b': { /* code-block dimension */ int cblockw_init = 0, cblockh_init = 0; sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init); - if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024 - || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) { + if (cblockw_init > 1024 || cblockw_init < 4 || + cblockh_init > 1024 || cblockh_init < 4 || + cblockw_init * cblockh_init > 4096) { fprintf(stderr, "!! Size of code_block error (option -b) !!\n\nRestriction :\n" " * width*height<=4096\n * 4<=width,height<= 1024\n\n"); |
