Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missed conversion from unsigned int to OPJ_INT32 #1398

Merged
merged 45 commits into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
33c2d33
Added multiplication check to calloc calls in opj_compress, opj_decom…
Eharve14 Jan 13, 2022
d564919
Added multiplication check for calloc calls, see comment on commit 79…
Eharve14 Jan 13, 2022
c261172
Delete settings.json
Eharve14 Jan 13, 2022
fc2d47a
Fixed typo
Eharve14 Jan 13, 2022
85b471f
Merge branch 'master' of https://github.com/Eharve14/openjpeg
Eharve14 Jan 13, 2022
e74ee84
Revised to address int overflow in for loop only
Eharve14 Jan 13, 2022
d8fe126
Revert "Revised to address int overflow in for loop only"
Eharve14 Jan 13, 2022
968cf54
Revised to catch negitive values of num_images
Eharve14 Jan 13, 2022
efa9c7e
Revised to casts, deleted all other changes
Eharve14 Jan 13, 2022
98f4ace
style updates
Eharve14 Jan 13, 2022
a0b7102
Style part two
Eharve14 Jan 13, 2022
3058194
I am bad and I feel bad, I should have just used the scrypt
Eharve14 Jan 13, 2022
7c42257
Why, why is this happening
Eharve14 Jan 13, 2022
323a089
Update src/bin/jp2/opj_dump.c
rouault Jan 13, 2022
e27cfb3
Update src/bin/jp2/opj_dump.c
rouault Jan 13, 2022
ab6c7c7
Added overflow check to get_num_images, defined num_images as unsigne…
Eharve14 Jan 13, 2022
dbe64d6
Fixed style
Eharve14 Jan 13, 2022
957a6cd
Revert "Fixed style"
Eharve14 Jan 13, 2022
cbc8b26
Revert "Added overflow check to get_num_images, defined num_images as…
Eharve14 Jan 13, 2022
3882583
Merge pull request #1 from uclouvain/master
Eharve14 Jan 13, 2022
912a144
Fixed issues with get_num_images, moved the zero file check to preven…
Eharve14 Jan 13, 2022
96c6587
Same as last
Eharve14 Jan 13, 2022
21ac2bb
Merge branch 'master' of https://github.com/Eharve14/openjpeg
Eharve14 Jan 13, 2022
081bc3e
Fixed style
Eharve14 Jan 13, 2022
e011787
Added import of limits.h, revised overflow check, Redefined Return va…
Eharve14 Jan 14, 2022
7766d9c
Added return statement to break iteration
Eharve14 Jan 15, 2022
67536c7
Style fix
Eharve14 Jan 15, 2022
43bf2be
Re-Revised to use break statement instead of return.
Eharve14 Jan 15, 2022
d2bffdf
Merge branch 'uclouvain:master' into master
Eharve14 Jan 15, 2022
3a71edf
TEst
Eharve14 Jan 15, 2022
26a5626
Set number of jobs to rh.
Eharve14 Jan 15, 2022
998366b
Style fix, deleted whitespace.
Eharve14 Jan 15, 2022
76d50ce
Corrected type for num_images in main, was singed integer
Eharve14 Jan 16, 2022
8f5f221
Delete dwt.c
Eharve14 Jan 16, 2022
a46ab03
Revert "Style fix, deleted whitespace."
Eharve14 Jan 16, 2022
79e4133
Revert "Set number of jobs to rh."
Eharve14 Jan 16, 2022
56f9a7e
Revert "TEst"
Eharve14 Jan 16, 2022
7e3b389
Merge branch 'master' of https://github.com/Eharve14/openjpeg
Eharve14 Jan 16, 2022
54a80d7
Reviesed to keep int type for other variables
Eharve14 Jan 16, 2022
fc88a30
same as last
Eharve14 Jan 16, 2022
85b248b
Resloved issue where imagino used to iterate through files retrived w…
Eharve14 Jan 16, 2022
1dbc41a
fixed iterator issue in for loop to set up dirptr
Eharve14 Jan 16, 2022
8bb3ea7
Stylefix
Eharve14 Jan 16, 2022
2947bf2
Fixed signed issues in print statements, correced addtional signed is…
Eharve14 Jan 16, 2022
c0ba980
Style fix
Eharve14 Jan 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/bin/jp2/opj_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,16 @@ static char * get_file_name(char *name)
return fname;
}

static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
static char get_next_file(unsigned int imageno, dircnt_t *dirptr,
img_fol_t *img_fol,
opj_cparameters_t *parameters)
{
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],
outfilename[OPJ_PATH_LEN], temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN] = "";

strcpy(image_filename, dirptr->filename[imageno]);
fprintf(stderr, "File Number %d \"%s\"\n", imageno, image_filename);
fprintf(stderr, "File Number %u \"%s\"\n", imageno, image_filename);
parameters->decod_format = get_file_format(image_filename);
if (parameters->decod_format == -1) {
return 1;
Expand Down Expand Up @@ -1995,7 +1996,7 @@ int main(int argc, char **argv)
fprintf(stderr, "\n");

if (img_fol.set_imgdir == 1) {
if (get_next_file((int)imageno, dirptr, &img_fol, &parameters)) {
if (get_next_file(imageno, dirptr, &img_fol, &parameters)) {
fprintf(stderr, "skipping file...\n");
continue;
}
Expand Down Expand Up @@ -2250,7 +2251,7 @@ int main(int argc, char **argv)
}
for (i = 0; i < l_nb_tiles; ++i) {
if (! opj_write_tile(l_codec, i, l_data, l_data_size, l_stream)) {
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %d!\n",
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %u!\n",
i);
opj_stream_destroy(l_stream);
opj_destroy_codec(l_codec);
Expand Down
10 changes: 5 additions & 5 deletions src/bin/jp2/opj_decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ typedef struct opj_decompress_params {
unsigned int get_num_images(char *imgdirpath);
int load_images(dircnt_t *dirptr, char *imgdirpath);
int get_file_format(const char *filename);
char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
char get_next_file(unsigned int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
opj_decompress_parameters *parameters);
static int infile_format(const char *fname);

Expand Down Expand Up @@ -475,15 +475,15 @@ const char* path_separator = "/";
#endif

/* -------------------------------------------------------------------------- */
char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
char get_next_file(unsigned int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
rouault marked this conversation as resolved.
Show resolved Hide resolved
opj_decompress_parameters *parameters)
{
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],
outfilename[OPJ_PATH_LEN], temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN] = "";

strcpy(image_filename, dirptr->filename[imageno]);
fprintf(stderr, "File Number %d \"%s\"\n", imageno, image_filename);
fprintf(stderr, "File Number %u \"%s\"\n", imageno, image_filename);
if (strlen(img_fol->imgdirpath) + strlen(path_separator) + strlen(
image_filename) + 1 > sizeof(infilename)) {
return 1;
Expand Down Expand Up @@ -1341,7 +1341,7 @@ int main(int argc, char **argv)
{
opj_decompress_parameters parameters; /* decompression parameters */

OPJ_INT32 num_images, imageno;
unsigned int num_images, imageno;
img_fol_t img_fol;
dircnt_t *dirptr = NULL;
int failed = 0;
Expand Down Expand Up @@ -1372,7 +1372,7 @@ int main(int argc, char **argv)

/* Initialize reading of directory */
if (img_fol.set_imgdir == 1) {
int it_image;
unsigned int it_image;
num_images = get_num_images(img_fol.imgdirpath);
if (num_images == 0) {
fprintf(stderr, "Folder is empty\n");
Expand Down
12 changes: 7 additions & 5 deletions src/bin/jp2/opj_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ typedef struct img_folder {
static unsigned int get_num_images(char *imgdirpath);
static int load_images(dircnt_t *dirptr, char *imgdirpath);
static int get_file_format(const char *filename);
static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
static char get_next_file(unsigned int imageno, dircnt_t *dirptr,
img_fol_t *img_fol,
opj_dparameters_t *parameters);
static int infile_format(const char *fname);

Expand Down Expand Up @@ -220,15 +221,16 @@ static int get_file_format(const char *filename)
}

/* -------------------------------------------------------------------------- */
static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
static char get_next_file(unsigned int imageno, dircnt_t *dirptr,
img_fol_t *img_fol,
opj_dparameters_t *parameters)
{
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],
outfilename[OPJ_PATH_LEN], temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN] = "";

strcpy(image_filename, dirptr->filename[imageno]);
fprintf(stderr, "File Number %d \"%s\"\n", imageno, image_filename);
fprintf(stderr, "File Number %u \"%s\"\n", imageno, image_filename);
parameters->decod_format = get_file_format(image_filename);
if (parameters->decod_format == -1) {
return 1;
Expand Down Expand Up @@ -492,7 +494,7 @@ int main(int argc, char *argv[])
opj_codestream_info_v2_t* cstr_info = NULL;
opj_codestream_index_t* cstr_index = NULL;

OPJ_INT32 num_images, imageno;
unsigned int num_images, imageno;
img_fol_t img_fol;
dircnt_t *dirptr = NULL;

Expand All @@ -514,7 +516,7 @@ int main(int argc, char *argv[])

/* Initialize reading of directory */
if (img_fol.set_imgdir == 1) {
int it_image;
unsigned int it_image;
num_images = get_num_images(img_fol.imgdirpath);
if (num_images == 0) {
fprintf(stdout, "Folder is empty\n");
Expand Down