From 33c2d33c5d3474c19f722f2ee7391ebf2544f9c9 Mon Sep 17 00:00:00 2001 From: Eric Harvey Date: Thu, 13 Jan 2022 00:53:55 -0500 Subject: [PATCH 01/14] Added multiplication check to calloc calls in opj_compress, opj_decompress, opj_dump. See comment on commit 79c7d7a. --- src/bin/jp2/opj_compress.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index 1399d5277..efe22d81c 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1957,6 +1957,11 @@ int main(int argc, char **argv) /* Read directory if necessary */ if (img_fol.set_imgdir == 1) { num_images = get_num_images(img_fol.imgdirpath); + if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){ + fprintf(stdout, "Max images exceeded\n"); + ret = 0; + goto fin; + } else { dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); if (dirptr) { dirptr->filename_buf = (char*)calloc(num_images, OPJ_PATH_LEN * sizeof( @@ -1974,6 +1979,7 @@ int main(int argc, char **argv) ret = 0; goto fin; } + } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); ret = 0; From d564919d3a5f4fac4c5ef9d1c85b786aa41d700d Mon Sep 17 00:00:00 2001 From: Eric Harvey Date: Thu, 13 Jan 2022 00:55:34 -0500 Subject: [PATCH 02/14] Added multiplication check for calloc calls, see comment on commit 79c7d7a --- .vscode/settings.json | 5 +++++ src/bin/jp2/opj_decompress.c | 7 ++++++- src/bin/jp2/opj_dump.c | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..cc134d0ef --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "cstdlib": "c" + } +} \ No newline at end of file diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index e1217f891..22b7a1e70 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1367,7 +1367,11 @@ int main(int argc, char **argv) if (img_fol.set_imgdir == 1) { int it_image; num_images = get_num_images(img_fol.imgdirpath); - + if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN)){ + fprintf(stderr, "Max number of images exceeded\n"); + failed = 1; + goto fin; + } else { dirptr = (dircnt_t*)calloc(1, sizeof(dircnt_t)); if (!dirptr) { destroy_parameters(¶meters); @@ -1394,6 +1398,7 @@ int main(int argc, char **argv) failed = 1; goto fin; } + } if (num_images == 0) { fprintf(stderr, "Folder is empty\n"); failed = 1; diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index d2646f10e..73874e63d 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -516,6 +516,10 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } /* Stores at max 10 image file names*/ + if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){ + free(dirptr); + return EXIT_FAILURE; + }else{ dirptr->filename_buf = (char*) calloc((size_t) num_images, OPJ_PATH_LEN * sizeof(char)); if (!dirptr->filename_buf) { @@ -535,7 +539,7 @@ int main(int argc, char *argv[]) if (load_images(dirptr, img_fol.imgdirpath) == 1) { goto fails; } - + } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); goto fails; From c26117251b323af792551284d60d78f5b23ea80c Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 01:37:27 -0500 Subject: [PATCH 03/14] Delete settings.json Removed automatically generated settings.json --- .vscode/settings.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index cc134d0ef..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "cstdlib": "c" - } -} \ No newline at end of file From fc2d47a369ed4a55d1d1b0453576ae9fd97e6aea Mon Sep 17 00:00:00 2001 From: Eric Harvey Date: Thu, 13 Jan 2022 02:20:52 -0500 Subject: [PATCH 04/14] Fixed typo --- src/bin/jp2/opj_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index efe22d81c..d077d5399 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1957,7 +1957,7 @@ int main(int argc, char **argv) /* Read directory if necessary */ if (img_fol.set_imgdir == 1) { num_images = get_num_images(img_fol.imgdirpath); - if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){ + if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)))){ fprintf(stdout, "Max images exceeded\n"); ret = 0; goto fin; From e74ee84320208aa8e1952805fc602cc5d93e3838 Mon Sep 17 00:00:00 2001 From: Eric Harvey Date: Thu, 13 Jan 2022 10:44:11 -0500 Subject: [PATCH 05/14] Revised to address int overflow in for loop only --- src/bin/jp2/opj_compress.c | 8 +------- src/bin/jp2/opj_decompress.c | 9 +-------- src/bin/jp2/opj_dump.c | 8 +------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index d077d5399..ce3235d7f 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1957,11 +1957,6 @@ int main(int argc, char **argv) /* Read directory if necessary */ if (img_fol.set_imgdir == 1) { num_images = get_num_images(img_fol.imgdirpath); - if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)))){ - fprintf(stdout, "Max images exceeded\n"); - ret = 0; - goto fin; - } else { dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); if (dirptr) { dirptr->filename_buf = (char*)calloc(num_images, OPJ_PATH_LEN * sizeof( @@ -1971,7 +1966,7 @@ int main(int argc, char **argv) ret = 0; goto fin; } - for (i = 0; i < num_images; i++) { + for (size_t i = 0; i < num_images; i++) { dirptr->filename[i] = dirptr->filename_buf + i * OPJ_PATH_LEN; } } @@ -1979,7 +1974,6 @@ int main(int argc, char **argv) ret = 0; goto fin; } - } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); ret = 0; diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 22b7a1e70..75ef31570 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1365,13 +1365,7 @@ int main(int argc, char **argv) /* Initialize reading of directory */ if (img_fol.set_imgdir == 1) { - int it_image; num_images = get_num_images(img_fol.imgdirpath); - if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN)){ - fprintf(stderr, "Max number of images exceeded\n"); - failed = 1; - goto fin; - } else { dirptr = (dircnt_t*)calloc(1, sizeof(dircnt_t)); if (!dirptr) { destroy_parameters(¶meters); @@ -1390,7 +1384,7 @@ int main(int argc, char **argv) failed = 1; goto fin; } - for (it_image = 0; it_image < num_images; it_image++) { + for (size_t it_image = 0; it_image < num_images; it_image++) { dirptr->filename[it_image] = dirptr->filename_buf + it_image * OPJ_PATH_LEN; } @@ -1398,7 +1392,6 @@ int main(int argc, char **argv) failed = 1; goto fin; } - } if (num_images == 0) { fprintf(stderr, "Folder is empty\n"); failed = 1; diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 73874e63d..de35ba740 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -508,7 +508,6 @@ int main(int argc, char *argv[]) /* Initialize reading of directory */ if (img_fol.set_imgdir == 1) { - int it_image; num_images = get_num_images(img_fol.imgdirpath); dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); @@ -516,10 +515,6 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } /* Stores at max 10 image file names*/ - if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){ - free(dirptr); - return EXIT_FAILURE; - }else{ dirptr->filename_buf = (char*) calloc((size_t) num_images, OPJ_PATH_LEN * sizeof(char)); if (!dirptr->filename_buf) { @@ -532,14 +527,13 @@ int main(int argc, char *argv[]) goto fails; } - for (it_image = 0; it_image < num_images; it_image++) { + for (size_t it_image = 0; it_image < num_images; it_image++) { dirptr->filename[it_image] = dirptr->filename_buf + it_image * OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { goto fails; } - } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); goto fails; From d8fe12641e7645aa55269c532f21ca064546d20b Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 11:35:20 -0500 Subject: [PATCH 06/14] Revert "Revised to address int overflow in for loop only" This reverts commit e74ee84320208aa8e1952805fc602cc5d93e3838. --- src/bin/jp2/opj_compress.c | 8 +++++++- src/bin/jp2/opj_decompress.c | 9 ++++++++- src/bin/jp2/opj_dump.c | 8 +++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index ce3235d7f..d077d5399 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1957,6 +1957,11 @@ int main(int argc, char **argv) /* Read directory if necessary */ if (img_fol.set_imgdir == 1) { num_images = get_num_images(img_fol.imgdirpath); + if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)))){ + fprintf(stdout, "Max images exceeded\n"); + ret = 0; + goto fin; + } else { dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); if (dirptr) { dirptr->filename_buf = (char*)calloc(num_images, OPJ_PATH_LEN * sizeof( @@ -1966,7 +1971,7 @@ int main(int argc, char **argv) ret = 0; goto fin; } - for (size_t i = 0; i < num_images; i++) { + for (i = 0; i < num_images; i++) { dirptr->filename[i] = dirptr->filename_buf + i * OPJ_PATH_LEN; } } @@ -1974,6 +1979,7 @@ int main(int argc, char **argv) ret = 0; goto fin; } + } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); ret = 0; diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 75ef31570..22b7a1e70 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1365,7 +1365,13 @@ int main(int argc, char **argv) /* Initialize reading of directory */ if (img_fol.set_imgdir == 1) { + int it_image; num_images = get_num_images(img_fol.imgdirpath); + if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN)){ + fprintf(stderr, "Max number of images exceeded\n"); + failed = 1; + goto fin; + } else { dirptr = (dircnt_t*)calloc(1, sizeof(dircnt_t)); if (!dirptr) { destroy_parameters(¶meters); @@ -1384,7 +1390,7 @@ int main(int argc, char **argv) failed = 1; goto fin; } - for (size_t it_image = 0; it_image < num_images; it_image++) { + for (it_image = 0; it_image < num_images; it_image++) { dirptr->filename[it_image] = dirptr->filename_buf + it_image * OPJ_PATH_LEN; } @@ -1392,6 +1398,7 @@ int main(int argc, char **argv) failed = 1; goto fin; } + } if (num_images == 0) { fprintf(stderr, "Folder is empty\n"); failed = 1; diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index de35ba740..73874e63d 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -508,6 +508,7 @@ int main(int argc, char *argv[]) /* Initialize reading of directory */ if (img_fol.set_imgdir == 1) { + int it_image; num_images = get_num_images(img_fol.imgdirpath); dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); @@ -515,6 +516,10 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } /* Stores at max 10 image file names*/ + if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){ + free(dirptr); + return EXIT_FAILURE; + }else{ dirptr->filename_buf = (char*) calloc((size_t) num_images, OPJ_PATH_LEN * sizeof(char)); if (!dirptr->filename_buf) { @@ -527,13 +532,14 @@ int main(int argc, char *argv[]) goto fails; } - for (size_t it_image = 0; it_image < num_images; it_image++) { + for (it_image = 0; it_image < num_images; it_image++) { dirptr->filename[it_image] = dirptr->filename_buf + it_image * OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { goto fails; } + } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); goto fails; From 968cf54a954a6835aef8ea7aac7201b66ea5f9ec Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 12:04:59 -0500 Subject: [PATCH 07/14] Revised to catch negitive values of num_images --- src/bin/jp2/opj_compress.c | 2 +- src/bin/jp2/opj_decompress.c | 2 +- src/bin/jp2/opj_dump.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index d077d5399..8c531d17b 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1957,7 +1957,7 @@ int main(int argc, char **argv) /* Read directory if necessary */ if (img_fol.set_imgdir == 1) { num_images = get_num_images(img_fol.imgdirpath); - if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)))){ + if(num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)) || num_images < 0){ fprintf(stdout, "Max images exceeded\n"); ret = 0; goto fin; diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 22b7a1e70..c5c71e913 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1367,7 +1367,7 @@ int main(int argc, char **argv) if (img_fol.set_imgdir == 1) { int it_image; num_images = get_num_images(img_fol.imgdirpath); - if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN)){ + if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN) || num_images < 0){ fprintf(stderr, "Max number of images exceeded\n"); failed = 1; goto fin; diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 73874e63d..92921b33d 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -516,7 +516,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } /* Stores at max 10 image file names*/ - if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){ + if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)) || num_images < 0){ free(dirptr); return EXIT_FAILURE; }else{ From efa9c7e76b6a0e34f3a92e3df1006b4554ef4814 Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 12:48:58 -0500 Subject: [PATCH 08/14] Revised to casts, deleted all other changes --- src/bin/jp2/opj_compress.c | 8 +------- src/bin/jp2/opj_decompress.c | 9 ++------- src/bin/jp2/opj_dump.c | 7 +------ 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index 8c531d17b..646f13757 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1957,11 +1957,6 @@ int main(int argc, char **argv) /* Read directory if necessary */ if (img_fol.set_imgdir == 1) { num_images = get_num_images(img_fol.imgdirpath); - if(num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)) || num_images < 0){ - fprintf(stdout, "Max images exceeded\n"); - ret = 0; - goto fin; - } else { dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); if (dirptr) { dirptr->filename_buf = (char*)calloc(num_images, OPJ_PATH_LEN * sizeof( @@ -1972,14 +1967,13 @@ int main(int argc, char **argv) goto fin; } for (i = 0; i < num_images; i++) { - dirptr->filename[i] = dirptr->filename_buf + i * OPJ_PATH_LEN; + dirptr->filename[i] = dirptr->filename_buf + (size_t)i * OPJ_PATH_LEN; } } if (load_images(dirptr, img_fol.imgdirpath) == 1) { ret = 0; goto fin; } - } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); ret = 0; diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index c5c71e913..26a5d12fc 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1367,11 +1367,7 @@ int main(int argc, char **argv) if (img_fol.set_imgdir == 1) { int it_image; num_images = get_num_images(img_fol.imgdirpath); - if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN) || num_images < 0){ - fprintf(stderr, "Max number of images exceeded\n"); - failed = 1; - goto fin; - } else { + dirptr = (dircnt_t*)calloc(1, sizeof(dircnt_t)); if (!dirptr) { destroy_parameters(¶meters); @@ -1391,14 +1387,13 @@ int main(int argc, char **argv) goto fin; } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + it_image * OPJ_PATH_LEN; + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { failed = 1; goto fin; } - } if (num_images == 0) { fprintf(stderr, "Folder is empty\n"); failed = 1; diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 92921b33d..352a443eb 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -516,10 +516,6 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } /* Stores at max 10 image file names*/ - if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)) || num_images < 0){ - free(dirptr); - return EXIT_FAILURE; - }else{ dirptr->filename_buf = (char*) calloc((size_t) num_images, OPJ_PATH_LEN * sizeof(char)); if (!dirptr->filename_buf) { @@ -533,13 +529,12 @@ int main(int argc, char *argv[]) } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + it_image * OPJ_PATH_LEN; + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { goto fails; } - } if (num_images == 0) { fprintf(stdout, "Folder is empty\n"); goto fails; From 98f4acef63d806233644995514db9e6205b7f07c Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 12:58:28 -0500 Subject: [PATCH 09/14] style updates --- src/bin/jp2/opj_decompress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 26a5d12fc..b3ba3a692 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1367,7 +1367,6 @@ int main(int argc, char **argv) if (img_fol.set_imgdir == 1) { int it_image; num_images = get_num_images(img_fol.imgdirpath); - dirptr = (dircnt_t*)calloc(1, sizeof(dircnt_t)); if (!dirptr) { destroy_parameters(¶meters); @@ -1387,7 +1386,8 @@ int main(int argc, char **argv) goto fin; } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * OPJ_PATH_LEN; + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * + OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { From a0b71024349a7f09447d20b4cb96404611808fed Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 13:02:57 -0500 Subject: [PATCH 10/14] Style part two --- src/bin/jp2/opj_decompress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index b3ba3a692..dc7769d17 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1386,8 +1386,8 @@ int main(int argc, char **argv) goto fin; } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * - OPJ_PATH_LEN; + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * + OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { From 305819492c34f4af656765ab68d15c5fb2c73b2b Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 13:05:58 -0500 Subject: [PATCH 11/14] I am bad and I feel bad, I should have just used the scrypt --- src/bin/jp2/opj_decompress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index dc7769d17..0d3021cdf 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -1386,8 +1386,8 @@ int main(int argc, char **argv) goto fin; } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * - OPJ_PATH_LEN; + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * + OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { From 7c422579a3a01d5cc9029a363ef32fba2ade7596 Mon Sep 17 00:00:00 2001 From: Eharve14 <71228603+Eharve14@users.noreply.github.com> Date: Thu, 13 Jan 2022 13:17:40 -0500 Subject: [PATCH 12/14] Why, why is this happening --- src/bin/jp2/opj_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 352a443eb..42701b401 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -529,7 +529,8 @@ int main(int argc, char *argv[]) } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * OPJ_PATH_LEN; + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * + OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { From 323a08900344ddd1a2e225bd797c681e677678fd Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 13 Jan 2022 19:22:22 +0100 Subject: [PATCH 13/14] Update src/bin/jp2/opj_dump.c --- src/bin/jp2/opj_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 42701b401..3c783ef5a 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -530,7 +530,7 @@ int main(int argc, char *argv[]) for (it_image = 0; it_image < num_images; it_image++) { dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * - OPJ_PATH_LEN; + OPJ_PATH_LEN; } if (load_images(dirptr, img_fol.imgdirpath) == 1) { From e27cfb39c970bad97187081eac7a50e70dead4c9 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 13 Jan 2022 19:28:23 +0100 Subject: [PATCH 14/14] Update src/bin/jp2/opj_dump.c --- src/bin/jp2/opj_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 3c783ef5a..46b976a9a 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) } for (it_image = 0; it_image < num_images; it_image++) { - dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * + dirptr->filename[it_image] = dirptr->filename_buf + (size_t)it_image * OPJ_PATH_LEN; }