ENH: Fix unitialized read in img_fol (we may need a smarter initialize than memset)
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Thu, 6 Sep 2007 16:49:15 +0000 (16:49 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Thu, 6 Sep 2007 16:49:15 +0000 (16:49 +0000)
ChangeLog
codec/CMakeLists.txt
codec/image_to_j2k.c
codec/j2k_to_image.c

index 0cdd7892f5850d4cf2a38eab669c2c13e345af83..5aa3efda9d9713ab2206e58af8f0a517ddc1e657 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@ September 6, 2007
 + [Mathieu Malaterre] CMake: Add doxygen output
 + [GB] One more field in the codestream_info struct for recording the number of packets per tile part; JPWL now distributes the EPBs in all the tile part headers
 + [Mathieu Malaterre] CMake: Add very simple tests (simply run command line with no option)
+* [Mathieu Malaterre] Fix unitialized read in img_fol (we may need a smarter initialize than memset)
 
 September 4, 2007
 + [GB] Added some fields in the codestream_info structure: they are used to record the position of single tile parts. Changed also the write_index function in the codec, to reflect the presence of this new information.
index a381840cefe03d6b843a2315cc0963b5fd2209f4..363c8fd881f30176a36dd3939b7fd949d11d0e90 100644 (file)
@@ -42,7 +42,7 @@ FIND_PACKAGE(TIFF REQUIRED)
 FOREACH(exe j2k_to_image image_to_j2k)
   ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
   TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES})
-  ADD_TEST(${exe} ${exe})
+  ADD_TEST(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
   # On unix you need to link to the math library:
   IF(UNIX)
     TARGET_LINK_LIBRARIES(${exe} m)
index c921e2154b1b85a82e28f44114eb6fae755be4da..cbb9d0bc62684fec4b1e0e8543c870d32e6d736d 100644 (file)
@@ -1745,6 +1745,9 @@ int main(int argc, char **argv) {
        /* set encoding parameters to default values */
        opj_set_default_encoder_parameters(&parameters);
 
+       /* need to initialize img_fol since parameters will be read in parse_cmdline_decoder */
+       memset(&img_fol,0,sizeof(img_fol_t));
+
        /* parse input and get user encoding parameters */
        if(parse_cmdline_encoder(argc, argv, &parameters,&img_fol, &raw_cp) == 1) {
                return 0;
index f05845549d5dad9d657382cbc1041956c0ae5589..ee7741662645251e8b3f5daa6f4aacad9f479cbc 100644 (file)
@@ -517,6 +517,8 @@ int main(int argc, char **argv) {
        /* set decoding parameters to default values */
        opj_set_default_decoder_parameters(&parameters);
 
+       /* need to initialize img_fol since parameters will be read in parse_cmdline_decoder */
+       memset(&img_fol,0,sizeof(img_fol_t));
 
        /* parse input and get user encoding parameters */
        if(parse_cmdline_decoder(argc, argv, &parameters,&img_fol) == 1) {