Use of OPJ_PATH_LEN (defined as 4096) to be the maximum allowed size for filenames instead of MAX_PATH which is not always defined. This caused some programs using OpenJPEG to crash. Modifications in openjpeg.h j2k_to_image.c and image_to_j2k.c
This commit is contained in:
parent
d48feb45fc
commit
a6d7377213
|
@ -5,6 +5,10 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
January 30, 2007
|
||||||
|
! [FOD] Use of OPJ_PATH_LEN (defined as 4096) to be the maximum allowed size for filenames instead of MAX_PATH which is not always defined. This caused some programs using OpenJPEG to crash. Modifications in openjpeg.h j2k_to_image.c and image_to_j2k.c
|
||||||
|
! [FOD] Correction of the syntax usage in MJ2_codec/mj2_to_frames.c
|
||||||
|
|
||||||
January 23, 2007
|
January 23, 2007
|
||||||
! [FOD] Modification in the context numbers, to reflect what has been specified in standard, in libopenjpeg/t1.h
|
! [FOD] Modification in the context numbers, to reflect what has been specified in standard, in libopenjpeg/t1.h
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||||
infile);
|
infile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strncpy(parameters->infile, infile, MAX_PATH);
|
strncpy(parameters->infile, infile, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||||
fprintf(stderr, "Unknown output format image %s [only *.j2k, *.jp2]!! \n", outfile);
|
fprintf(stderr, "Unknown output format image %s [only *.j2k, *.jp2]!! \n", outfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strncpy(parameters->outfile, outfile, MAX_PATH);
|
strncpy(parameters->outfile, outfile, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||||
case 'x': /* creation of index file */
|
case 'x': /* creation of index file */
|
||||||
{
|
{
|
||||||
char *index = optarg;
|
char *index = optarg;
|
||||||
strncpy(parameters->index, index, MAX_PATH);
|
strncpy(parameters->index, index, OPJ_PATH_LEN);
|
||||||
parameters->index_on = 1;
|
parameters->index_on = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -668,7 +668,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||||
|
|
||||||
/* we need to enable indexing */
|
/* we need to enable indexing */
|
||||||
if (!parameters->index_on) {
|
if (!parameters->index_on) {
|
||||||
strncpy(parameters->index, JPWL_PRIVATEINDEX_NAME, MAX_PATH);
|
strncpy(parameters->index, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
|
||||||
parameters->index_on = 1;
|
parameters->index_on = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||||
infile);
|
infile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strncpy(parameters->infile, infile, MAX_PATH);
|
strncpy(parameters->infile, infile, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n", outfile);
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n", outfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strncpy(parameters->outfile, outfile, MAX_PATH);
|
strncpy(parameters->outfile, outfile, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,7 @@ braindamage below.
|
||||||
==========================================================
|
==========================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
#define OPJ_PATH_LEN 4096 /**< Maximum allowed size for filenames */
|
||||||
#define MAX_PATH 260 /**< Maximum allowed size for filenames */
|
|
||||||
#endif /* MAX_PATH */
|
|
||||||
|
|
||||||
#define J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */
|
#define J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */
|
||||||
#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
|
#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
|
||||||
|
@ -256,13 +254,13 @@ typedef struct opj_cparameters {
|
||||||
/**@name command line encoder parameters (not used inside the library) */
|
/**@name command line encoder parameters (not used inside the library) */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** input file name */
|
/** input file name */
|
||||||
char infile[MAX_PATH];
|
char infile[OPJ_PATH_LEN];
|
||||||
/** output file name */
|
/** output file name */
|
||||||
char outfile[MAX_PATH];
|
char outfile[OPJ_PATH_LEN];
|
||||||
/** creation of an index file, default to 0 (false) */
|
/** creation of an index file, default to 0 (false) */
|
||||||
int index_on;
|
int index_on;
|
||||||
/** index file name */
|
/** index file name */
|
||||||
char index[MAX_PATH];
|
char index[OPJ_PATH_LEN];
|
||||||
/** subimage encoding: origin image offset in x direction */
|
/** subimage encoding: origin image offset in x direction */
|
||||||
int image_offset_x0;
|
int image_offset_x0;
|
||||||
/** subimage encoding: origin image offset in y direction */
|
/** subimage encoding: origin image offset in y direction */
|
||||||
|
@ -336,9 +334,9 @@ typedef struct opj_dparameters {
|
||||||
/**@name command line encoder parameters (not used inside the library) */
|
/**@name command line encoder parameters (not used inside the library) */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** input file name */
|
/** input file name */
|
||||||
char infile[MAX_PATH];
|
char infile[OPJ_PATH_LEN];
|
||||||
/** output file name */
|
/** output file name */
|
||||||
char outfile[MAX_PATH];
|
char outfile[OPJ_PATH_LEN];
|
||||||
/** input file format 0: J2K, 1: JP2, 2: JPT */
|
/** input file format 0: J2K, 1: JP2, 2: JPT */
|
||||||
int decod_format;
|
int decod_format;
|
||||||
/** output file format 0: PGX, 1: PxM, 2: BMP */
|
/** output file format 0: PGX, 1: PxM, 2: BMP */
|
||||||
|
|
Loading…
Reference in New Issue