openjpeg-2.5.2-4.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1]
openjpeg-2.5.2-build/openjpeg-2.5.2/redhat-linux-build/CMakeFiles/TestLargeFiles.c: scope_hint: In function ‘main’
openjpeg-2.5.2-build/openjpeg-2.5.2/redhat-linux-build/CMakeFiles/TestLargeFiles.c:17:18: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(*argv, "r")’ where non-null expected
openjpeg-2.5.2-build/openjpeg-2.5.2/redhat-linux-build/CMakeFiles/TestLargeFiles.c:6: included_from: Included from here.
/usr/include/stdio.h:799:16: note: argument 1 of ‘ftello’ must be non-null
#   15|     int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
#   16|     FILE *fp = fopen(argv[0],"r");
#   17|->   off_t offset = ftello( fp );
#   18|   
#   19|     fseeko( fp, offset, SEEK_CUR );

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/common/opj_getopt.c: scope_hint: In function ‘opj_getopt’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/common/opj_getopt.c:103:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘oli’
#  101|           }
#  102|       }
#  103|->     if (*++oli != ':') {      /* don't need argument */
#  104|           opj_optarg = NULL;
#  105|           if (!*place) {

Error: GCC_ANALYZER_WARNING (CWE-122): [#def3]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convert.c: scope_hint: In function ‘imagetopgx’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convert.c:1383:9: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
# 1381|               }
# 1382|           }
# 1383|->         memcpy(name, outfile, dotpos);
# 1384|           sprintf(name + dotpos, "_%u.pgx", compno);
# 1385|           fdest = fopen(name, "wb");

Error: GCC_ANALYZER_WARNING (CWE-122): [#def4]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convert.c:1384:9: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
# 1382|           }
# 1383|           memcpy(name, outfile, dotpos);
# 1384|->         sprintf(name + dotpos, "_%u.pgx", compno);
# 1385|           fdest = fopen(name, "wb");
# 1386|           /* don't need name anymore */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c: scope_hint: In function ‘pngtoimage’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:281:9: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
/usr/include/libpng16/pngconf.h:51: included_from: Included from here.
/usr/include/libpng16/png.h:334: included_from: Included from here.
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:47: included_from: Included from here.
#  279|                   free(rows[i]);
#  280|               }
#  281|->         free(rows);
#  282|       }
#  283|       if (row32s) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c: scope_hint: In function ‘imagetopng’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:396:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(write_idf, "wb")’
#  394|       writer = fopen(write_idf, "wb");
#  395|   
#  396|->     if (writer == NULL) {
#  397|           return fails;
#  398|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:396:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(write_idf, "wb")’
#  394|       writer = fopen(write_idf, "wb");
#  395|   
#  396|->     if (writer == NULL) {
#  397|           return fails;
#  398|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:485:21: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(png_get_rowbytes(png,  info))’
#  483|           }
#  484|           row_buf = (png_bytep)malloc(png_row_size);
#  485|->         if (row_buf == NULL) {
#  486|               fprintf(stderr, "Can't allocate memory for PNG row\n");
#  487|               goto fin;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:491:23: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc((long unsigned int)*image_176(D)->comps.w * (long unsigned int)nr_comp * 4)’
#  489|           buffer32s = (OPJ_INT32*)malloc((OPJ_SIZE_T)image->comps[0].w *
#  490|                                          (OPJ_SIZE_T)nr_comp * sizeof(OPJ_INT32));
#  491|->         if (buffer32s == NULL) {
#  492|               fprintf(stderr, "Can't allocate memory for interleaved 32s row\n");
#  493|               goto fin;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/convertpng.c:524:13: warning[-Wanalyzer-jump-through-null]: jump through null pointer
#  522|           for (y = 0; y < image->comps[0].h; ++y) {
#  523|               cvtPxToCx(planes, buffer32s_cpy, width, adjust);
#  524|->             cvt32sToPack(buffer32s_cpy, row_buf_cpy, width * (OPJ_SIZE_T)nr_comp);
#  525|               png_write_row(png, row_buf_cpy);
#  526|               planes[0] += width;

Error: CPPCHECK_WARNING (CWE-190): [#def11]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:957: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
#  955|   
#  956|           if (length > 1U) {
#  957|->             GETBITS(pDst[i + 1], 9)
#  958|               if (length > 2U) {
#  959|                   GETBITS(pDst[i + 2], 9)

Error: CPPCHECK_WARNING (CWE-758): [#def12]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:957: error[shiftTooManyBits]: Shifting 32-bit value by 4294967295 bits is undefined behaviour
#  955|   
#  956|           if (length > 1U) {
#  957|->             GETBITS(pDst[i + 1], 9)
#  958|               if (length > 2U) {
#  959|                   GETBITS(pDst[i + 2], 9)

Error: CPPCHECK_WARNING (CWE-190): [#def13]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:959: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
#  957|               GETBITS(pDst[i + 1], 9)
#  958|               if (length > 2U) {
#  959|->                 GETBITS(pDst[i + 2], 9)
#  960|                   if (length > 3U) {
#  961|                       GETBITS(pDst[i + 3], 9)

Error: CPPCHECK_WARNING (CWE-758): [#def14]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:959: error[shiftTooManyBits]: Shifting 32-bit value by 4294967295 bits is undefined behaviour
#  957|               GETBITS(pDst[i + 1], 9)
#  958|               if (length > 2U) {
#  959|->                 GETBITS(pDst[i + 2], 9)
#  960|                   if (length > 3U) {
#  961|                       GETBITS(pDst[i + 3], 9)

Error: CPPCHECK_WARNING (CWE-190): [#def15]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:961: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
#  959|                   GETBITS(pDst[i + 2], 9)
#  960|                   if (length > 3U) {
#  961|->                     GETBITS(pDst[i + 3], 9)
#  962|                       if (length > 4U) {
#  963|                           GETBITS(pDst[i + 4], 9)

Error: CPPCHECK_WARNING (CWE-758): [#def16]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:961: error[shiftTooManyBits]: Shifting 32-bit value by 4294967295 bits is undefined behaviour
#  959|                   GETBITS(pDst[i + 2], 9)
#  960|                   if (length > 3U) {
#  961|->                     GETBITS(pDst[i + 3], 9)
#  962|                       if (length > 4U) {
#  963|                           GETBITS(pDst[i + 4], 9)

Error: CPPCHECK_WARNING (CWE-190): [#def17]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:963: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
#  961|                       GETBITS(pDst[i + 3], 9)
#  962|                       if (length > 4U) {
#  963|->                         GETBITS(pDst[i + 4], 9)
#  964|                           if (length > 5U) {
#  965|                               GETBITS(pDst[i + 5], 9)

Error: CPPCHECK_WARNING (CWE-758): [#def18]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:963: error[shiftTooManyBits]: Shifting 32-bit value by 4294967295 bits is undefined behaviour
#  961|                       GETBITS(pDst[i + 3], 9)
#  962|                       if (length > 4U) {
#  963|->                         GETBITS(pDst[i + 4], 9)
#  964|                           if (length > 5U) {
#  965|                               GETBITS(pDst[i + 5], 9)

Error: CPPCHECK_WARNING (CWE-190): [#def19]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:965: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
#  963|                           GETBITS(pDst[i + 4], 9)
#  964|                           if (length > 5U) {
#  965|->                             GETBITS(pDst[i + 5], 9)
#  966|                               if (length > 6U) {
#  967|                                   GETBITS(pDst[i + 6], 9)

Error: CPPCHECK_WARNING (CWE-758): [#def20]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:965: error[shiftTooManyBits]: Shifting 32-bit value by 4294967295 bits is undefined behaviour
#  963|                           GETBITS(pDst[i + 4], 9)
#  964|                           if (length > 5U) {
#  965|->                             GETBITS(pDst[i + 5], 9)
#  966|                               if (length > 6U) {
#  967|                                   GETBITS(pDst[i + 6], 9)

Error: CPPCHECK_WARNING (CWE-190): [#def21]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:967: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
#  965|                               GETBITS(pDst[i + 5], 9)
#  966|                               if (length > 6U) {
#  967|->                                 GETBITS(pDst[i + 6], 9)
#  968|                               }
#  969|                           }

Error: CPPCHECK_WARNING (CWE-758): [#def22]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:967: error[shiftTooManyBits]: Shifting 32-bit value by 4294967295 bits is undefined behaviour
#  965|                               GETBITS(pDst[i + 5], 9)
#  966|                               if (length > 6U) {
#  967|->                                 GETBITS(pDst[i + 6], 9)
#  968|                               }
#  969|                           }

Error: CPPCHECK_WARNING (CWE-190): [#def23]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1045: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1043|   
# 1044|           if (length > 1U) {
# 1045|->             GETBITS(pDst[i + 1], 11)
# 1046|               if (length > 2U) {
# 1047|                   GETBITS(pDst[i + 2], 11)

Error: CPPCHECK_WARNING (CWE-758): [#def24]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1045: error[shiftTooManyBits]: Shifting 32-bit value by 4294967293 bits is undefined behaviour
# 1043|   
# 1044|           if (length > 1U) {
# 1045|->             GETBITS(pDst[i + 1], 11)
# 1046|               if (length > 2U) {
# 1047|                   GETBITS(pDst[i + 2], 11)

Error: CPPCHECK_WARNING (CWE-190): [#def25]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1047: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1045|               GETBITS(pDst[i + 1], 11)
# 1046|               if (length > 2U) {
# 1047|->                 GETBITS(pDst[i + 2], 11)
# 1048|                   if (length > 3U) {
# 1049|                       GETBITS(pDst[i + 3], 11)

Error: CPPCHECK_WARNING (CWE-758): [#def26]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1047: error[shiftTooManyBits]: Shifting 32-bit value by 4294967293 bits is undefined behaviour
# 1045|               GETBITS(pDst[i + 1], 11)
# 1046|               if (length > 2U) {
# 1047|->                 GETBITS(pDst[i + 2], 11)
# 1048|                   if (length > 3U) {
# 1049|                       GETBITS(pDst[i + 3], 11)

Error: CPPCHECK_WARNING (CWE-190): [#def27]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1049: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1047|                   GETBITS(pDst[i + 2], 11)
# 1048|                   if (length > 3U) {
# 1049|->                     GETBITS(pDst[i + 3], 11)
# 1050|                       if (length > 4U) {
# 1051|                           GETBITS(pDst[i + 4], 11)

Error: CPPCHECK_WARNING (CWE-758): [#def28]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1049: error[shiftTooManyBits]: Shifting 32-bit value by 4294967293 bits is undefined behaviour
# 1047|                   GETBITS(pDst[i + 2], 11)
# 1048|                   if (length > 3U) {
# 1049|->                     GETBITS(pDst[i + 3], 11)
# 1050|                       if (length > 4U) {
# 1051|                           GETBITS(pDst[i + 4], 11)

Error: CPPCHECK_WARNING (CWE-190): [#def29]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1051: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1049|                       GETBITS(pDst[i + 3], 11)
# 1050|                       if (length > 4U) {
# 1051|->                         GETBITS(pDst[i + 4], 11)
# 1052|                           if (length > 5U) {
# 1053|                               GETBITS(pDst[i + 5], 11)

Error: CPPCHECK_WARNING (CWE-758): [#def30]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1051: error[shiftTooManyBits]: Shifting 32-bit value by 4294967293 bits is undefined behaviour
# 1049|                       GETBITS(pDst[i + 3], 11)
# 1050|                       if (length > 4U) {
# 1051|->                         GETBITS(pDst[i + 4], 11)
# 1052|                           if (length > 5U) {
# 1053|                               GETBITS(pDst[i + 5], 11)

Error: CPPCHECK_WARNING (CWE-190): [#def31]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1053: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1051|                           GETBITS(pDst[i + 4], 11)
# 1052|                           if (length > 5U) {
# 1053|->                             GETBITS(pDst[i + 5], 11)
# 1054|                               if (length > 6U) {
# 1055|                                   GETBITS(pDst[i + 6], 11)

Error: CPPCHECK_WARNING (CWE-758): [#def32]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1053: error[shiftTooManyBits]: Shifting 32-bit value by 4294967293 bits is undefined behaviour
# 1051|                           GETBITS(pDst[i + 4], 11)
# 1052|                           if (length > 5U) {
# 1053|->                             GETBITS(pDst[i + 5], 11)
# 1054|                               if (length > 6U) {
# 1055|                                   GETBITS(pDst[i + 6], 11)

Error: CPPCHECK_WARNING (CWE-190): [#def33]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1055: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1053|                               GETBITS(pDst[i + 5], 11)
# 1054|                               if (length > 6U) {
# 1055|->                                 GETBITS(pDst[i + 6], 11)
# 1056|                               }
# 1057|                           }

Error: CPPCHECK_WARNING (CWE-758): [#def34]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1055: error[shiftTooManyBits]: Shifting 32-bit value by 4294967293 bits is undefined behaviour
# 1053|                               GETBITS(pDst[i + 5], 11)
# 1054|                               if (length > 6U) {
# 1055|->                                 GETBITS(pDst[i + 6], 11)
# 1056|                               }
# 1057|                           }

Error: CPPCHECK_WARNING (CWE-190): [#def35]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1120: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1118|   
# 1119|           if (length > 1U) {
# 1120|->             GETBITS(pDst[i + 1], 13)
# 1121|               if (length > 2U) {
# 1122|                   GETBITS(pDst[i + 2], 13)

Error: CPPCHECK_WARNING (CWE-758): [#def36]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1120: error[shiftTooManyBits]: Shifting 32-bit value by 4294967291 bits is undefined behaviour
# 1118|   
# 1119|           if (length > 1U) {
# 1120|->             GETBITS(pDst[i + 1], 13)
# 1121|               if (length > 2U) {
# 1122|                   GETBITS(pDst[i + 2], 13)

Error: CPPCHECK_WARNING (CWE-190): [#def37]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1122: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1120|               GETBITS(pDst[i + 1], 13)
# 1121|               if (length > 2U) {
# 1122|->                 GETBITS(pDst[i + 2], 13)
# 1123|                   if (length > 3U) {
# 1124|                       GETBITS(pDst[i + 3], 13)

Error: CPPCHECK_WARNING (CWE-758): [#def38]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1122: error[shiftTooManyBits]: Shifting 32-bit value by 4294967291 bits is undefined behaviour
# 1120|               GETBITS(pDst[i + 1], 13)
# 1121|               if (length > 2U) {
# 1122|->                 GETBITS(pDst[i + 2], 13)
# 1123|                   if (length > 3U) {
# 1124|                       GETBITS(pDst[i + 3], 13)

Error: CPPCHECK_WARNING (CWE-190): [#def39]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1124: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1122|                   GETBITS(pDst[i + 2], 13)
# 1123|                   if (length > 3U) {
# 1124|->                     GETBITS(pDst[i + 3], 13)
# 1125|                       if (length > 4U) {
# 1126|                           GETBITS(pDst[i + 4], 13)

Error: CPPCHECK_WARNING (CWE-758): [#def40]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1124: error[shiftTooManyBits]: Shifting 32-bit value by 4294967291 bits is undefined behaviour
# 1122|                   GETBITS(pDst[i + 2], 13)
# 1123|                   if (length > 3U) {
# 1124|->                     GETBITS(pDst[i + 3], 13)
# 1125|                       if (length > 4U) {
# 1126|                           GETBITS(pDst[i + 4], 13)

Error: CPPCHECK_WARNING (CWE-190): [#def41]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1126: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1124|                       GETBITS(pDst[i + 3], 13)
# 1125|                       if (length > 4U) {
# 1126|->                         GETBITS(pDst[i + 4], 13)
# 1127|                           if (length > 5U) {
# 1128|                               GETBITS(pDst[i + 5], 13)

Error: CPPCHECK_WARNING (CWE-758): [#def42]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1126: error[shiftTooManyBits]: Shifting 32-bit value by 4294967291 bits is undefined behaviour
# 1124|                       GETBITS(pDst[i + 3], 13)
# 1125|                       if (length > 4U) {
# 1126|->                         GETBITS(pDst[i + 4], 13)
# 1127|                           if (length > 5U) {
# 1128|                               GETBITS(pDst[i + 5], 13)

Error: CPPCHECK_WARNING (CWE-190): [#def43]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1128: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1126|                           GETBITS(pDst[i + 4], 13)
# 1127|                           if (length > 5U) {
# 1128|->                             GETBITS(pDst[i + 5], 13)
# 1129|                               if (length > 6U) {
# 1130|                                   GETBITS(pDst[i + 6], 13)

Error: CPPCHECK_WARNING (CWE-758): [#def44]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1128: error[shiftTooManyBits]: Shifting 32-bit value by 4294967291 bits is undefined behaviour
# 1126|                           GETBITS(pDst[i + 4], 13)
# 1127|                           if (length > 5U) {
# 1128|->                             GETBITS(pDst[i + 5], 13)
# 1129|                               if (length > 6U) {
# 1130|                                   GETBITS(pDst[i + 6], 13)

Error: CPPCHECK_WARNING (CWE-190): [#def45]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1130: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1128|                               GETBITS(pDst[i + 5], 13)
# 1129|                               if (length > 6U) {
# 1130|->                                 GETBITS(pDst[i + 6], 13)
# 1131|                               }
# 1132|                           }

Error: CPPCHECK_WARNING (CWE-758): [#def46]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1130: error[shiftTooManyBits]: Shifting 32-bit value by 4294967291 bits is undefined behaviour
# 1128|                               GETBITS(pDst[i + 5], 13)
# 1129|                               if (length > 6U) {
# 1130|->                                 GETBITS(pDst[i + 6], 13)
# 1131|                               }
# 1132|                           }

Error: CPPCHECK_WARNING (CWE-190): [#def47]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1216: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1214|   
# 1215|           if (length > 1U) {
# 1216|->             GETBITS(pDst[i + 1], 15)
# 1217|               if (length > 2U) {
# 1218|                   GETBITS(pDst[i + 2], 15)

Error: CPPCHECK_WARNING (CWE-758): [#def48]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1216: error[shiftTooManyBits]: Shifting 32-bit value by 4294967289 bits is undefined behaviour
# 1214|   
# 1215|           if (length > 1U) {
# 1216|->             GETBITS(pDst[i + 1], 15)
# 1217|               if (length > 2U) {
# 1218|                   GETBITS(pDst[i + 2], 15)

Error: CPPCHECK_WARNING (CWE-190): [#def49]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1218: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1216|               GETBITS(pDst[i + 1], 15)
# 1217|               if (length > 2U) {
# 1218|->                 GETBITS(pDst[i + 2], 15)
# 1219|                   if (length > 3U) {
# 1220|                       GETBITS(pDst[i + 3], 15)

Error: CPPCHECK_WARNING (CWE-758): [#def50]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1218: error[shiftTooManyBits]: Shifting 32-bit value by 4294967289 bits is undefined behaviour
# 1216|               GETBITS(pDst[i + 1], 15)
# 1217|               if (length > 2U) {
# 1218|->                 GETBITS(pDst[i + 2], 15)
# 1219|                   if (length > 3U) {
# 1220|                       GETBITS(pDst[i + 3], 15)

Error: CPPCHECK_WARNING (CWE-190): [#def51]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1220: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1218|                   GETBITS(pDst[i + 2], 15)
# 1219|                   if (length > 3U) {
# 1220|->                     GETBITS(pDst[i + 3], 15)
# 1221|                       if (length > 4U) {
# 1222|                           GETBITS(pDst[i + 4], 15)

Error: CPPCHECK_WARNING (CWE-758): [#def52]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1220: error[shiftTooManyBits]: Shifting 32-bit value by 4294967289 bits is undefined behaviour
# 1218|                   GETBITS(pDst[i + 2], 15)
# 1219|                   if (length > 3U) {
# 1220|->                     GETBITS(pDst[i + 3], 15)
# 1221|                       if (length > 4U) {
# 1222|                           GETBITS(pDst[i + 4], 15)

Error: CPPCHECK_WARNING (CWE-190): [#def53]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1222: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1220|                       GETBITS(pDst[i + 3], 15)
# 1221|                       if (length > 4U) {
# 1222|->                         GETBITS(pDst[i + 4], 15)
# 1223|                           if (length > 5U) {
# 1224|                               GETBITS(pDst[i + 5], 15)

Error: CPPCHECK_WARNING (CWE-758): [#def54]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1222: error[shiftTooManyBits]: Shifting 32-bit value by 4294967289 bits is undefined behaviour
# 1220|                       GETBITS(pDst[i + 3], 15)
# 1221|                       if (length > 4U) {
# 1222|->                         GETBITS(pDst[i + 4], 15)
# 1223|                           if (length > 5U) {
# 1224|                               GETBITS(pDst[i + 5], 15)

Error: CPPCHECK_WARNING (CWE-190): [#def55]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1224: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1222|                           GETBITS(pDst[i + 4], 15)
# 1223|                           if (length > 5U) {
# 1224|->                             GETBITS(pDst[i + 5], 15)
# 1225|                               if (length > 6U) {
# 1226|                                   GETBITS(pDst[i + 6], 15)

Error: CPPCHECK_WARNING (CWE-758): [#def56]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1224: error[shiftTooManyBits]: Shifting 32-bit value by 4294967289 bits is undefined behaviour
# 1222|                           GETBITS(pDst[i + 4], 15)
# 1223|                           if (length > 5U) {
# 1224|->                             GETBITS(pDst[i + 5], 15)
# 1225|                               if (length > 6U) {
# 1226|                                   GETBITS(pDst[i + 6], 15)

Error: CPPCHECK_WARNING (CWE-190): [#def57]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1226: error[integerOverflow]: Signed integer overflow for expression 'available-needed'.
# 1224|                               GETBITS(pDst[i + 5], 15)
# 1225|                               if (length > 6U) {
# 1226|->                                 GETBITS(pDst[i + 6], 15)
# 1227|                               }
# 1228|                           }

Error: CPPCHECK_WARNING (CWE-758): [#def58]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/converttif.c:1226: error[shiftTooManyBits]: Shifting 32-bit value by 4294967289 bits is undefined behaviour
# 1224|                               GETBITS(pDst[i + 5], 15)
# 1225|                               if (length > 6U) {
# 1226|->                                 GETBITS(pDst[i + 6], 15)
# 1227|                               }
# 1228|                           }

Error: GCC_ANALYZER_WARNING: [#def59]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/opj_compress.c: scope_hint: In function ‘parse_cmdline_encoder’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/opj_compress.c:1363:32: warning[-Wanalyzer-imprecise-fp-arithmetic]: use of floating-point arithmetic here might yield unexpected results
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/opj_compress.c:1363:32: note: only use operands of an integer type inside the size argument
# 1361|               lMctComp = lNbComp * lNbComp;
# 1362|               lTotalComp = lMctComp + lNbComp;
# 1363|->             lSpace = (float *) malloc((size_t)lTotalComp * sizeof(float));
# 1364|               if (lSpace == NULL) {
# 1365|                   free(lMatrix);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def60]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/opj_dump.c: scope_hint: In function ‘parse_cmdline_decoder’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/bin/jp2/opj_dump.c:402:33: warning[-Wanalyzer-malloc-leak]: leak of ‘img_fol.imgdirpath’
#  400|   
#  401|           case 'y': {         /* Image Directory path */
#  402|->             img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
#  403|               if (img_fol->imgdirpath == NULL) {
#  404|                   return 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def61]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/j2k.c: scope_hint: In function ‘opj_j2k_write_plt_in_memory’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/j2k.c:4722:32: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘marker_info’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/opj_includes.h:228: included_from: Included from here.
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/j2k.c:44: included_from: Included from here.
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/j2k.c:4807:5: note: in expansion of macro ‘opj_write_bytes’
# 4720|       Lplt = 3;
# 4721|   
# 4722|->     for (i = 0; i < marker_info->packet_count; i++) {
# 4723|           OPJ_BYTE var_bytes[5];
# 4724|           OPJ_UINT8 var_bytes_size = 0;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def62]
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/j2k.c: scope_hint: In function ‘opj_j2k_decode_tiles’
openjpeg-2.5.2-build/openjpeg-2.5.2/src/lib/openjp2/j2k.c:11701:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘l_current_tile_no’
#11699|           }
#11700|   
#11701|->         if (! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
#11702|                                     p_stream, p_manager)) {
#11703|               opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile 1/1\n");

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-100.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameopenjpeg-2.5.2-4.fc42
store-results-to/tmp/tmp_k_6j_u4/openjpeg-2.5.2-4.fc42.tar.xz
time-created2024-11-13 02:10:59
time-finished2024-11-13 02:13:50
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp_k_6j_u4/openjpeg-2.5.2-4.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp_k_6j_u4/openjpeg-2.5.2-4.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9