LibRaw-0.21.4-1.fc43

List of Findings

Error: COMPILER_WARNING (CWE-195): [#def1]
LibRaw-0.21.4/src/decoders/dng.cpp: scope_hint: In member function 'void LibRaw::lossy_dng_load_raw()'
LibRaw-0.21.4/internal/defines.h:100:33: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'unsigned int' and 'int'
#  100 | #define FORC(cnt) for (c = 0; c < cnt; c++)
LibRaw-0.21.4/src/decoders/dng.cpp:268:11: note: in expansion of macro 'FORC'
#  268 |           FORC(colors) image[row * width + tcol + col][c] = cur[c][buf[col*colors+c]];
#      |           ^~~~
#   98|   #define LONG_BIT (8 * sizeof(long))
#   99|   #endif
#  100|-> #define FORC(cnt) for (c = 0; c < cnt; c++)
#  101|   #define FORC3 FORC(3)
#  102|   #define FORC4 FORC(4)

Error: COMPILER_WARNING (CWE-195): [#def2]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp: scope_hint: In member function 'void LibRaw::selectCRXTrack()'
LibRaw-0.21.4/internal/defines.h:107:24: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'}
#  107 | #define MIN(a, b) ((a) < (b) ? (a) : (b))
#      |                    ~~~~^~~~~
LibRaw-0.21.4/internal/defines.h:108:27: note: in definition of macro 'MAX'
#  108 | #define MAX(a, b) ((a) > (b) ? (a) : (b))
#      |                           ^
LibRaw-0.21.4/internal/defines.h:109:35: note: in expansion of macro 'MIN'
#  109 | #define LIM(x, min, max) MAX(min, MIN(x, max))
#      |                                   ^~~
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:145:22: note: in expansion of macro 'LIM'
#  145 |           int fsel = LIM(frame_select, 0, d->sample_count);
#      |                      ^~~
#  105|   #define SQR(x) ((x) * (x))
#  106|   #define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31))
#  107|-> #define MIN(a, b) ((a) < (b) ? (a) : (b))
#  108|   #define MAX(a, b) ((a) > (b) ? (a) : (b))
#  109|   #define LIM(x, min, max) MAX(min, MIN(x, max))

Error: COMPILER_WARNING: [#def3]
LibRaw-0.21.4/libraw/libraw.h:86: included_from: Included from here.
LibRaw-0.21.4/internal/libraw_cxx_defs.h:28: included_from: Included from here.
LibRaw-0.21.4/libraw/libraw_alloc.h: scope_hint: In member function 'libraw_memmgr::realloc(void*, unsigned long)'
LibRaw-0.21.4/libraw/libraw_alloc.h:63:15: warning[-Wuse-after-free]: pointer 'ptr_7(D)' used after 'realloc'
#   63 |     forget_ptr(ptr);
#      |     ~~~~~~~~~~^~~~~
LibRaw-0.21.4/libraw/libraw_alloc.h:62:26: note: call to 'realloc' here
#   62 |     void *ret = ::realloc(ptr, newsz + extra_bytes);
#      |                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#   61|     {
#   62|       void *ret = ::realloc(ptr, newsz + extra_bytes);
#   63|->     forget_ptr(ptr);
#   64|       mem_ptr(ret);
#   65|       return ret;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
LibRaw-0.21.4/samples/half_mt.c:162:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘queue’
LibRaw-0.21.4/samples/half_mt.c:134:6: branch_false: following ‘false’ branch (when ‘ac > 1’)...
LibRaw-0.21.4/samples/half_mt.c:137:18: branch_false: ...to here
LibRaw-0.21.4/samples/half_mt.c:137:11: acquire_memory: this call could return NULL
LibRaw-0.21.4/samples/half_mt.c:139:15: branch_true: following ‘true’ branch (when ‘i < ac’)...
LibRaw-0.21.4/samples/half_mt.c:141:11: branch_true: ...to here
LibRaw-0.21.4/samples/half_mt.c:141:8: branch_false: following ‘false’ branch...
LibRaw-0.21.4/samples/half_mt.c:162:12: branch_false: ...to here
LibRaw-0.21.4/samples/half_mt.c:162:7: danger: ‘queue + qsize * 8’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  160|       }
#  161|       else
#  162|->       queue[qsize++] = av[i];
#  163|     }
#  164|     pthread_mutex_init(&qm, NULL);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
LibRaw-0.21.4/samples/half_mt.c:167:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘threads’ where non-null expected
LibRaw-0.21.4/samples/half_mt.c:134:6: branch_false: following ‘false’ branch (when ‘ac > 1’)...
LibRaw-0.21.4/samples/half_mt.c:137:18: branch_false: ...to here
LibRaw-0.21.4/samples/half_mt.c:139:15: branch_true: following ‘true’ branch (when ‘i < ac’)...
LibRaw-0.21.4/samples/half_mt.c:141:11: branch_true: ...to here
LibRaw-0.21.4/samples/half_mt.c:139:15: branch_false: following ‘false’ branch (when ‘i >= ac’)...
LibRaw-0.21.4/samples/half_mt.c:164:3: branch_false: ...to here
LibRaw-0.21.4/samples/half_mt.c:165:13: acquire_memory: this call could return NULL
LibRaw-0.21.4/samples/half_mt.c:166:15: branch_true: following ‘true’ branch (when ‘i < max_threads’)...
LibRaw-0.21.4/samples/half_mt.c:167:28: branch_true: ...to here
LibRaw-0.21.4/samples/half_mt.c:167:5: danger: argument 1 (‘threads + (long unsigned int)i * 8’) from [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
#  165|     threads = calloc(max_threads, sizeof(threads[0]));
#  166|     for (i = 0; i < max_threads; i++)
#  167|->     pthread_create(&threads[i], NULL, process_files, NULL);
#  168|     for (i = 0; i < max_threads; i++)
#  169|     {

Error: CPPCHECK_WARNING (CWE-476): [#def6]
LibRaw-0.21.4/samples/half_mt.c:171: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: threads
#  169|     {
#  170|       int *iptr;
#  171|->     if (threads[i])
#  172|       {
#  173|         pthread_join(threads[i], (void *)&iptr);

Error: COMPILER_WARNING (CWE-483): [#def7]
LibRaw-0.21.4/src/decoders/crx.cpp: scope_hint: In function 'int crxMakeQStep(CrxImage*, CrxTile*, int32_t*, uint32_t)'
LibRaw-0.21.4/src/decoders/crx.cpp:2004:3: warning[-Wmisleading-indentation]: this 'if' clause does not guard...
# 2004 |   if (img->levels > 2)
#      |   ^~
LibRaw-0.21.4/src/decoders/crx.cpp:2006:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
# 2006 |     tile->qStep = (CrxQStep *)
#      |     ^~~~
# 2002|     if (img->levels > 1)

# 2003|       totalHeight += qpHeight4;

# 2004|->   if (img->levels > 2)

# 2005|       totalHeight += qpHeight8;

# 2006|       tile->qStep = (CrxQStep *)


Error: COMPILER_WARNING (CWE-195): [#def8]
LibRaw-0.21.4/src/decoders/crx.cpp: scope_hint: In member function 'void LibRaw::crxLoadRaw()'
LibRaw-0.21.4/src/decoders/crx.cpp:2696:13: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'unsigned int' and 'int32_t' {aka 'int'}
# 2696 |   if (bytes != hdr.mdatHdrSize)
#      |       ~~~~~~^~~~~~~~~~~~~~~~~~
# 2694|     }

# 2695|   

# 2696|->   if (bytes != hdr.mdatHdrSize)

# 2697|       throw LIBRAW_EXCEPTION_IO_EOF;

# 2698|   


Error: CPPCHECK_WARNING (CWE-823): [#def9]
LibRaw-0.21.4/src/decoders/decoders_libraw.cpp:97: error[arrayIndexOutOfBounds]: Array 'tiff_ifd[10]' accessed at index 15, which is out of bounds.
#   95|       }
#   96|       for (; tidx < 16; tidx++)
#   97|->       if (tiff_ifd[tidx].t_width == imgdata.sizes.raw_width &&
#   98|             tiff_ifd[tidx].t_height == imgdata.sizes.raw_height &&
#   99|             tiff_ifd[tidx].bps > 8 && tiff_ifd[tidx].samples == 1)

Error: CPPCHECK_WARNING (CWE-823): [#def10]
LibRaw-0.21.4/src/decoders/decoders_libraw.cpp:104: error[arrayIndexOutOfBounds]: Array 'tiff_ifd[10]' accessed at index 15, which is out of bounds.
#  102|         break;
#  103|       imgdata.rawdata.raw_image = plane;
#  104|->     ID.input->seek(tiff_ifd[tidx].offset, SEEK_SET);
#  105|       imgdata.idata.filters = 0xb4b4b4b4;
#  106|       libraw_internal_data.unpacker_data.data_offset = tiff_ifd[tidx].offset;

Error: CPPCHECK_WARNING (CWE-823): [#def11]
LibRaw-0.21.4/src/decoders/decoders_libraw.cpp:106: error[arrayIndexOutOfBounds]: Array 'tiff_ifd[10]' accessed at index 15, which is out of bounds.
#  104|       ID.input->seek(tiff_ifd[tidx].offset, SEEK_SET);
#  105|       imgdata.idata.filters = 0xb4b4b4b4;
#  106|->     libraw_internal_data.unpacker_data.data_offset = tiff_ifd[tidx].offset;
#  107|       (this->*pentax_component_load_raw)();
#  108|       for (int row = 0; row < imgdata.sizes.raw_height - move_row; row++)

Error: COMPILER_WARNING (CWE-195): [#def12]
LibRaw-0.21.4/src/decoders/decoders_libraw_dcrdefs.cpp: scope_hint: In member function 'void LibRaw::sony_ljpeg_load_raw()'
LibRaw-0.21.4/src/decoders/decoders_libraw_dcrdefs.cpp:91:65: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'unsigned int' and 'int'
#   91 |       for (row = jrow = 0; jrow < (unsigned)jh.high && trow+row < raw_height-1; jrow++, row += 2)
#      |                                                        ~~~~~~~~~^~~~~~~~~~~~~~
#   89|       try
#   90|       {
#   91|->       for (row = jrow = 0; jrow < (unsigned)jh.high && trow+row < raw_height-1; jrow++, row += 2)
#   92|         {
#   93|           checkCancel();

Error: COMPILER_WARNING (CWE-195): [#def13]
LibRaw-0.21.4/src/decoders/decoders_libraw_dcrdefs.cpp:95:67: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'unsigned int' and 'int'
#   95 |         for (col = jcol = 0; jcol < (unsigned)jh.wide && tcol+col < raw_width-1; jcol++, col += 2)
#      |                                                          ~~~~~~~~~^~~~~~~~~~~~~
#   93|           checkCancel();
#   94|           ushort(*rowp)[4] = (ushort(*)[4])ljpeg_row(jrow, &jh);
#   95|->         for (col = jcol = 0; jcol < (unsigned)jh.wide && tcol+col < raw_width-1; jcol++, col += 2)
#   96|           {
#   97|             RAW(trow + row, tcol + col) = rowp[jcol][0];

Error: COMPILER_WARNING (CWE-195): [#def14]
LibRaw-0.21.4/src/decoders/fp_dng.cpp: scope_hint: In member function 'void LibRaw::uncompressed_fp_dng_load_raw()'
LibRaw-0.21.4/src/decoders/fp_dng.cpp:642:51: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'}
#  642 |                 unsigned char *dst = fullrowbytes > inrowbytes ? rowbuf.data(): // last tile in row, use buffer
#      |                                      ~~~~~~~~~~~~~^~~~~~~~~~~~
#  640|               for (size_t row = 0; row < rowsInTile; ++row) // do not process full tile if not needed
#  641|               {
#  642|->                 unsigned char *dst = fullrowbytes > inrowbytes ? rowbuf.data(): // last tile in row, use buffer
#  643|                       (unsigned char *)&float_raw_image
#  644|                       [((y + row) * imgdata.sizes.raw_width + x) * ifd->samples];

Error: COMPILER_WARNING (CWE-195): [#def15]
LibRaw-0.21.4/src/decoders/fp_dng.cpp:657:34: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'}
#  657 |                 if (fullrowbytes > inrowbytes) // last tile in row: copy buffer to destination
#      |                     ~~~~~~~~~~~~~^~~~~~~~~~~~
#  655|                       tiles.tileWidth * ifd->samples,
#  656|                       bytesps);
#  657|->                 if (fullrowbytes > inrowbytes) // last tile in row: copy buffer to destination
#  658|                       memmove(&float_raw_image[((y + row) * imgdata.sizes.raw_width + x) * ifd->samples], dst, outrowbytes);
#  659|                   max = MAX(max, lmax);

Error: COMPILER_WARNING (CWE-195): [#def16]
LibRaw-0.21.4/src/decoders/load_mfbacks.cpp: scope_hint: In member function 'int LibRaw::phase_one_correct()'
LibRaw-0.21.4/src/decoders/load_mfbacks.cpp:524:66: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'unsigned int'
#  524 |                         if (j == 0 || j == head[1] || k < 1 || k >= w0+w1)
#      |                                                                ~~^~~~~~~~
#  522|                 if (num < xval[0][k = head[1] * i + j])
#  523|                   break;
#  524|-> 			if (j == 0 || j == head[1] || k < 1 || k >= w0+w1)
#  525|   				frac = 0;
#  526|   			else

Error: COMPILER_WARNING (CWE-195): [#def17]
LibRaw-0.21.4/src/decoders/load_mfbacks.cpp:531:31: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'unsigned int'
#  531 |                         if (k < w0 + w1)
#      |                             ~~^~~~~~~~~
#  529|   				frac = xdiv ? (xval[0][k] - num) / (xval[0][k] - xval[0][k - 1]) : 0;
#  530|   			}
#  531|-> 			if (k < w0 + w1)
#  532|   				mult[i - cip] = yval[0][k > 0 ? k - 1 : 0] * frac + yval[0][k] * (1 - frac);
#  533|   			else

Error: CPPCHECK_WARNING (CWE-823): [#def18]
LibRaw-0.21.4/src/demosaic/ahd_demosaic.cpp:58: error[arrayIndexOutOfBounds]: Array 'rgb[3]' accessed at index 3, which is out of bounds.
#   56|     FORCC
#   57|     {
#   58|->     xyz[0] += xyz_cam[0][c] * rgb[c];
#   59|       xyz[1] += xyz_cam[1][c] * rgb[c];
#   60|       xyz[2] += xyz_cam[2][c] * rgb[c];

Error: CPPCHECK_WARNING (CWE-823): [#def19]
LibRaw-0.21.4/src/demosaic/ahd_demosaic.cpp:59: error[arrayIndexOutOfBounds]: Array 'rgb[3]' accessed at index 3, which is out of bounds.
#   57|     {
#   58|       xyz[0] += xyz_cam[0][c] * rgb[c];
#   59|->     xyz[1] += xyz_cam[1][c] * rgb[c];
#   60|       xyz[2] += xyz_cam[2][c] * rgb[c];
#   61|     }

Error: CPPCHECK_WARNING (CWE-823): [#def20]
LibRaw-0.21.4/src/demosaic/ahd_demosaic.cpp:60: error[arrayIndexOutOfBounds]: Array 'rgb[3]' accessed at index 3, which is out of bounds.
#   58|       xyz[0] += xyz_cam[0][c] * rgb[c];
#   59|       xyz[1] += xyz_cam[1][c] * rgb[c];
#   60|->     xyz[2] += xyz_cam[2][c] * rgb[c];
#   61|     }
#   62|     xyz[0] = cbrt[CLIP((int)xyz[0])];

Error: CPPCHECK_WARNING (CWE-476): [#def21]
LibRaw-0.21.4/src/demosaic/dht_demosaic.cpp:228: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: nraw
#  226|     channel_minimum[2] = libraw.imgdata.image[0][2];
#  227|     for (int i = 0; i < nr_height * nr_width; ++i)
#  228|->     nraw[i][0] = nraw[i][1] = nraw[i][2] = 0.5;
#  229|     for (int i = 0; i < libraw.imgdata.sizes.iheight; ++i)
#  230|     {

Error: COMPILER_WARNING (CWE-195): [#def22]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp: scope_hint: In member function 'int LibRaw::selectCRXFrame(short int, unsigned int)'
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:38:21: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'}
#   38 |   for (int i = 0; i < hdr->chunk_count; i++)
#      |                   ~~^~~~~~~~~~~~~~~~~~
#   36|       return -1;
#   37|   
#   38|->   for (int i = 0; i < hdr->chunk_count; i++)
#   39|     {
#   40|       int64_t current_offset = hdr->chunk_offsets[i];

Error: COMPILER_WARNING (CWE-195): [#def23]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:42:50: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'}
#   42 |     while((stsc_index < hdr->stsc_count) && (i+1 == hdr->stsc_data[stsc_index+1].first))
#      |                                              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   40|       int64_t current_offset = hdr->chunk_offsets[i];
#   41|   
#   42|->     while((stsc_index < hdr->stsc_count) && (i+1 == hdr->stsc_data[stsc_index+1].first))
#   43|         stsc_index++;
#   44|   

Error: COMPILER_WARNING (CWE-195): [#def24]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:45:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'}
#   45 |     for (int j = 0; j < hdr->stsc_data[stsc_index].count; j++)
#      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   43|         stsc_index++;
#   44|   
#   45|->     for (int j = 0; j < hdr->stsc_data[stsc_index].count; j++)
#   46|       {
#   47|         if (current_sample > hdr->sample_count)

Error: COMPILER_WARNING (CWE-563): [#def25]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:71:47: warning[-Wunused-variable]: unused variable 'maxframecount'
#   71 |   int framecounts[LIBRAW_CRXTRACKS_MAXCOUNT], maxframecount = 0;
#      |                                               ^~~~~~~~~~~~~
#   69|   
#   70|     INT64 bitcounts[LIBRAW_CRXTRACKS_MAXCOUNT], maxbitcount = 0;
#   71|->   int framecounts[LIBRAW_CRXTRACKS_MAXCOUNT], maxframecount = 0;
#   72|     uint32_t maxjpegbytes = 0;
#   73|     int framecnt = 0;

Error: COMPILER_WARNING (CWE-563): [#def26]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:77:7: warning[-Wunused-variable]: unused variable 'err'
#   77 |   int err;
#      |       ^~~
#   75|     int track_select = 0;
#   76|     int frame_select = 0;
#   77|->   int err;
#   78|     memset(bitcounts, 0, sizeof(bitcounts));
#   79|     memset(framecounts, 0, sizeof(framecounts));

Error: COMPILER_WARNING (CWE-563): [#def27]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:142:19: warning[-Wunused-variable]: unused variable 'trackcnt'
#  142 |   for (int i = 0, trackcnt = 0; i <= maxTrack && i < LIBRAW_CRXTRACKS_MAXCOUNT; i++)
#      |                   ^~~~~~~~
#  140|   
#  141|     // Frame selected: parse CTMD metadata
#  142|->   for (int i = 0, trackcnt = 0; i <= maxTrack && i < LIBRAW_CRXTRACKS_MAXCOUNT; i++)
#  143|     {
#  144|   	  crx_data_header_t *d = &libraw_internal_data.unpacker_data.crx_header[i];

Error: COMPILER_WARNING (CWE-563): [#def28]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:448:12: warning[-Wunused-variable]: unused variable 'relpos_inDir'
#  448 |   uint32_t relpos_inDir, relpos_inBox;
#      |            ^~~~~~~~~~~~
#  446|     uchar CDI1[60];
#  447|     char HandlerType[5], MediaFormatID[5];
#  448|->   uint32_t relpos_inDir, relpos_inBox;
#  449|     unsigned szItem, Tag, lTag;
#  450|     ushort tItem;

Error: COMPILER_WARNING (CWE-563): [#def29]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:448:26: warning[-Wunused-variable]: unused variable 'relpos_inBox'
#  448 |   uint32_t relpos_inDir, relpos_inBox;
#      |                          ^~~~~~~~~~~~
#  446|     uchar CDI1[60];
#  447|     char HandlerType[5], MediaFormatID[5];
#  448|->   uint32_t relpos_inDir, relpos_inBox;
#  449|     unsigned szItem, Tag, lTag;
#  450|     ushort tItem;

Error: COMPILER_WARNING (CWE-563): [#def30]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:449:12: warning[-Wunused-variable]: unused variable 'szItem'
#  449 |   unsigned szItem, Tag, lTag;
#      |            ^~~~~~
#  447|     char HandlerType[5], MediaFormatID[5];
#  448|     uint32_t relpos_inDir, relpos_inBox;
#  449|->   unsigned szItem, Tag, lTag;
#  450|     ushort tItem;
#  451|   

Error: COMPILER_WARNING (CWE-563): [#def31]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:449:20: warning[-Wunused-variable]: unused variable 'Tag'
#  449 |   unsigned szItem, Tag, lTag;
#      |                    ^~~
#  447|     char HandlerType[5], MediaFormatID[5];
#  448|     uint32_t relpos_inDir, relpos_inBox;
#  449|->   unsigned szItem, Tag, lTag;
#  450|     ushort tItem;
#  451|   

Error: COMPILER_WARNING (CWE-563): [#def32]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:449:25: warning[-Wunused-variable]: unused variable 'lTag'
#  449 |   unsigned szItem, Tag, lTag;
#      |                         ^~~~
#  447|     char HandlerType[5], MediaFormatID[5];
#  448|     uint32_t relpos_inDir, relpos_inBox;
#  449|->   unsigned szItem, Tag, lTag;
#  450|     ushort tItem;
#  451|   

Error: COMPILER_WARNING (CWE-563): [#def33]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:450:10: warning[-Wunused-variable]: unused variable 'tItem'
#  450 |   ushort tItem;
#      |          ^~~~~
#  448|     uint32_t relpos_inDir, relpos_inBox;
#  449|     unsigned szItem, Tag, lTag;
#  450|->   ushort tItem;
#  451|   
#  452|     nmAtom[0] = MediaFormatID[0] = nmAtom[4] = MediaFormatID[4] = '\0';

Error: COMPILER_WARNING (CWE-195): [#def34]
LibRaw-0.21.4/src/metadata/cr3_parser.cpp: scope_hint: In member function 'int LibRaw::parseCR3(INT64, INT64, short int&, char*, short int&, short int&)'
LibRaw-0.21.4/src/metadata/cr3_parser.cpp:827:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'}
#  827 |         for (i = 0; i < entries; i++)
#      |                     ~~^~~~~~~~~
#  825|   
#  826|           current_track.chunk_count = entries;
#  827|->         for (i = 0; i < entries; i++)
#  828|             current_track.chunk_offsets[i] = (((int64_t)get4()) << 32) | get4();
#  829|   

Error: COMPILER_WARNING: [#def35]
LibRaw-0.21.4/src/metadata/fuji.cpp:918:45: warning[-Wformat-truncation=]: ' ' directive output may be truncated writing 1 byte into a region of size between 0 and 63
#  918 |           snprintf(tbuf, sizeof(tbuf)-1, "%s %s",
#      |                                             ^
/usr/include/bits/stdio2.h:68:35: note: '__snprintf_chk' output 2 or more bytes (assuming 65) into a destination of size 63
#   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
#      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   69 |                                    __glibc_objsize (__s), __fmt,
#      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   70 |                                    __va_arg_pack ());
#      |                                    ~~~~~~~~~~~~~~~~~
#  916|           {
#  917|             char tbuf[sizeof(imgdata.shootinginfo.InternalBodySerial)];
#  918|->           snprintf(tbuf, sizeof(tbuf)-1, "%s %s",
#  919|                      imgdata.shootinginfo.InternalBodySerial, words[i]);
#  920|             strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,

Error: COMPILER_WARNING: [#def36]
LibRaw-0.21.4/src/metadata/fuji.cpp: scope_hint: In member function 'LibRaw::parseFujiMakernotes(unsigned int, unsigned int, unsigned int, unsigned int)'
LibRaw-0.21.4/src/metadata/fuji.cpp:920:18: warning[-Wstringop-truncation]: 'strncpy' output may be truncated copying 63 bytes from a string of length 63
#  920 |           strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,
#      |                  ^
#  918|             snprintf(tbuf, sizeof(tbuf)-1, "%s %s",
#  919|                      imgdata.shootinginfo.InternalBodySerial, words[i]);
#  920|->           strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,
#  921|                     sizeof(imgdata.shootinginfo.InternalBodySerial) - 1);
#  922|           }

Error: COMPILER_WARNING: [#def37]
LibRaw-0.21.4/src/metadata/fuji.cpp: scope_hint: In member function 'LibRaw::parseFujiMakernotes(unsigned int, unsigned int, unsigned int, unsigned int)'
LibRaw-0.21.4/src/metadata/fuji.cpp:940:16: warning[-Wstringop-truncation]: 'strncpy' specified bound 2 equals destination size
#  940 |         strncpy(
#      |                ^
#  938|                   16,
#  939|               2);
#  940|->         strncpy(
#  941|               yy,
#  942|               words[i] +

Error: COMPILER_WARNING: [#def38]
LibRaw-0.21.4/src/metadata/fuji.cpp:989:18: warning[-Wstringop-truncation]: 'strncpy' output may be truncated copying 63 bytes from a string of length 63
#  989 |           strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,
#      |                  ^
#  987|                       12);
#  988|             }
#  989|->           strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,
#  990|                     sizeof(imgdata.shootinginfo.InternalBodySerial) - 1);
#  991|           }

Error: COMPILER_WARNING: [#def39]
LibRaw-0.21.4/src/metadata/fuji.cpp:996:39: warning[-Wformat-truncation=]: '%s' directive output may be truncated writing up to 15 bytes into a region of size between 0 and 63
#  996 |               tbuf, sizeof(tbuf), "%s %s %d:%s:%s %s",
#      |                                       ^~
#  997 |               imgdata.shootinginfo.InternalBodySerial, ystr, year, mm, dd,
#      |                                                        ~~~~
LibRaw-0.21.4/src/metadata/fuji.cpp:996:35: note: directive argument in the range [64, 2769]
#  996 |               tbuf, sizeof(tbuf), "%s %s %d:%s:%s %s",
#      |                                   ^~~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio2.h:68:35: note: '__snprintf_chk' output 8 or more bytes (assuming 92) into a destination of size 64
#   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
#      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   69 |                                    __glibc_objsize (__s), __fmt,
#      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   70 |                                    __va_arg_pack ());
#      |                                    ~~~~~~~~~~~~~~~~~
#  994|             char tbuf[sizeof(imgdata.shootinginfo.InternalBodySerial)];
#  995|             snprintf(
#  996|->               tbuf, sizeof(tbuf), "%s %s %d:%s:%s %s",
#  997|                 imgdata.shootinginfo.InternalBodySerial, ystr, year, mm, dd,
#  998|                 words[i] +

Error: COMPILER_WARNING: [#def40]
LibRaw-0.21.4/src/metadata/fuji.cpp: scope_hint: In member function 'LibRaw::parseFujiMakernotes(unsigned int, unsigned int, unsigned int, unsigned int)'
LibRaw-0.21.4/src/metadata/fuji.cpp:1002:18: warning[-Wstringop-truncation]: 'strncpy' output may be truncated copying 63 bytes from a string of length 63
# 1002 |           strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,
#      |                  ^
# 1000|                             sizeof(imgdata.shootinginfo.InternalBodySerial) - 1) -
# 1001|                     12);
# 1002|->           strncpy(imgdata.shootinginfo.InternalBodySerial, tbuf,
# 1003|                     sizeof(imgdata.shootinginfo.InternalBodySerial) - 1);
# 1004|           }

Error: COMPILER_WARNING: [#def41]
LibRaw-0.21.4/src/metadata/hasselblad_model.cpp: scope_hint: In member function 'LibRaw::parseHassyModel()'
LibRaw-0.21.4/src/metadata/hasselblad_model.cpp:192:14: warning[-Wstringop-truncation]: 'strncpy' output may be truncated copying 63 bytes from a string of length 63
#  192 |       strncpy(imHassy.SensorUnit, model,63);
#      |              ^
#  190|       ps = strchr(model, '-');

#  191|       if (ps) {                  // check if model contains both host body and sensor version, resolution, MS info

#  192|->       strncpy(imHassy.SensorUnit, model,63);

#  193|         memcpy(imHassy.HostBody, model, ps-model);

#  194|         imHassy.HostBody[ps-model] = 0;


Error: COMPILER_WARNING (CWE-195): [#def42]
LibRaw-0.21.4/src/metadata/identify.cpp: scope_hint: In member function 'void LibRaw::identify()'
LibRaw-0.21.4/src/metadata/identify.cpp:498:14: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'INT64' {aka 'long long int'} and 'long long unsigned int'
#  498 |   if(fsize64 > LIBRAW_MAX_NONDNG_RAW_FILE_SIZE && fsize64 > LIBRAW_MAX_DNG_RAW_FILE_SIZE)
#  496|     fseek(ifp, 0, SEEK_END);
#  497|     fsize64 = ftell(ifp);
#  498|->   if(fsize64 > LIBRAW_MAX_NONDNG_RAW_FILE_SIZE && fsize64 > LIBRAW_MAX_DNG_RAW_FILE_SIZE)
#  499|         throw LIBRAW_EXCEPTION_TOOBIG;
#  500|   

Error: COMPILER_WARNING (CWE-195): [#def43]
LibRaw-0.21.4/src/metadata/identify.cpp:498:59: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'INT64' {aka 'long long int'} and 'long long unsigned int'
#  498 |   if(fsize64 > LIBRAW_MAX_NONDNG_RAW_FILE_SIZE && fsize64 > LIBRAW_MAX_DNG_RAW_FILE_SIZE)
#  496|     fseek(ifp, 0, SEEK_END);
#  497|     fsize64 = ftell(ifp);
#  498|->   if(fsize64 > LIBRAW_MAX_NONDNG_RAW_FILE_SIZE && fsize64 > LIBRAW_MAX_DNG_RAW_FILE_SIZE)
#  499|         throw LIBRAW_EXCEPTION_TOOBIG;
#  500|   

Error: COMPILER_WARNING (CWE-195): [#def44]
LibRaw-0.21.4/src/metadata/identify.cpp:725:19: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'INT64' {aka 'long long int'} and 'long long unsigned int'
#  725 |       if (fsize64 > LIBRAW_MAX_DNG_RAW_FILE_SIZE)
#  723|     if (dng_version)
#  724|     {
#  725|->       if (fsize64 > LIBRAW_MAX_DNG_RAW_FILE_SIZE)
#  726|             throw LIBRAW_EXCEPTION_TOOBIG;
#  727|     }

Error: COMPILER_WARNING (CWE-195): [#def45]
LibRaw-0.21.4/src/metadata/identify.cpp:730:17: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'INT64' {aka 'long long int'} and 'long long unsigned int'
#  730 |     if (fsize64 > LIBRAW_MAX_NONDNG_RAW_FILE_SIZE)
#  728|     else
#  729|     {
#  730|->     if (fsize64 > LIBRAW_MAX_NONDNG_RAW_FILE_SIZE)
#  731|         throw LIBRAW_EXCEPTION_TOOBIG;
#  732|     }

Error: COMPILER_WARNING (CWE-195): [#def46]
LibRaw-0.21.4/src/metadata/tiff.cpp: scope_hint: In member function 'int LibRaw::parse_tiff_ifd(int)'
LibRaw-0.21.4/src/metadata/tiff.cpp:1060:48: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'unsigned int'
# 1060 |                                         if (fj > libraw_internal_data.unpacker_data.lenRAFData - 3)
#      |                                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1058|                   for (fj = fi; fj < (fi + 15); fj += 3) // looking for the end of the WB table
# 1059|                   {
# 1060|-> 					if (fj > libraw_internal_data.unpacker_data.lenRAFData - 3)
# 1061|   						break;
# 1062|                     if (rafdata[fj] != rafdata[fi])

Error: COMPILER_WARNING (CWE-195): [#def47]
LibRaw-0.21.4/src/metadata/tiff.cpp:1069:57: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'unsigned int'
# 1069 |                                                 && ofst < libraw_internal_data.unpacker_data.lenRAFData - 3;
#      |                                                    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1067|   //printf ("wb start in DNG: 0x%04x\n", fj*2-0x4e);
# 1068|                       for (int iCCT = 0, ofst = fj; iCCT < 31 
# 1069|-> 						&& ofst < libraw_internal_data.unpacker_data.lenRAFData - 3;
# 1070|                            iCCT++, ofst += 3)
# 1071|                       {

Error: COMPILER_WARNING (CWE-252): [#def48]
LibRaw-0.21.4/src/preprocessing/ext_preprocess.cpp: scope_hint: In member function 'void LibRaw::subtract(const char*)'
LibRaw-0.21.4/src/preprocessing/ext_preprocess.cpp:119:10: warning[-Wunused-result]: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)' declared with attribute 'warn_unused_result'
#  119 |     fread(pixel.data(), 2, width, fp);
#      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  117|     for (row = 0; row < height; row++)
#  118|     {
#  119|->     fread(pixel.data(), 2, width, fp);
#  120|       for (col = 0; col < width; col++)
#  121|         BAYER(row, col) = MAX(BAYER(row, col) - ntohs(pixel[col]), 0);

Error: CPPCHECK_WARNING (CWE-786): [#def49]
LibRaw-0.21.4/src/utils/curves.cpp:152: error[negativeIndex]: Array 'imgdata.color.curve[65536]' accessed at index -1, which is out of bounds.
#  150|     read_shorts(curve, len);
#  151|     for (i = len; i < 0x10000; i++)
#  152|->     curve[i] = curve[i - 1];
#  153|     maximum = curve[len < 0x1000 ? 0xfff : len - 1];
#  154|   }

Error: COMPILER_WARNING (CWE-758): [#def50]
LibRaw-0.21.4/src/utils/utils_libraw.cpp: scope_hint: In member function 'void LibRaw::libraw_swab(void*, size_t)'
LibRaw-0.21.4/src/utils/utils_libraw.cpp:670:13: warning[-Wrestrict]: passing argument 2 to 'restrict'-qualified parameter aliases with argument 1
#  670 |         swab((char*)arr,(char*)arr,len);
#      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#  668|   	}
#  669|   #else
#  670|-> 	swab((char*)arr,(char*)arr,len);
#  671|   #endif
#  672|   

Error: COMPILER_WARNING (CWE-563): [#def51]
LibRaw-0.21.4/src/write/apply_profile.cpp: scope_hint: In member function 'void LibRaw::apply_profile(const char*, const char*)'
LibRaw-0.21.4/src/write/apply_profile.cpp:24:9: warning[-Wunused-variable]: unused variable 'prof'
#   24 |   char *prof;
#      |         ^~~~
#   22|   void LibRaw::apply_profile(const char *input, const char *output)
#   23|   {
#   24|->   char *prof;
#   25|     cmsHPROFILE hInProfile = 0, hOutProfile = 0;
#   26|     cmsHTRANSFORM hTransform;

Error: COMPILER_WARNING (CWE-252): [#def52]
LibRaw-0.21.4/src/write/apply_profile.cpp:49:10: warning[-Wunused-result]: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)' declared with attribute 'warn_unused_result'
#   49 |     fread(&size, 4, 1, fp);
#      |     ~~~~~^~~~~~~~~~~~~~~~~
#   47|     else if ((fp = fopen(output, "rb")))
#   48|     {
#   49|->     fread(&size, 4, 1, fp);
#   50|       fseek(fp, 0, SEEK_SET);
#   51|       oprof = (unsigned *)calloc(size = ntohl(size),1);

Error: COMPILER_WARNING (CWE-252): [#def53]
LibRaw-0.21.4/src/write/apply_profile.cpp:52:10: warning[-Wunused-result]: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)' declared with attribute 'warn_unused_result'
#   52 |     fread(oprof, 1, size, fp);
#      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
#   50|       fseek(fp, 0, SEEK_SET);
#   51|       oprof = (unsigned *)calloc(size = ntohl(size),1);
#   52|->     fread(oprof, 1, size, fp);
#   53|       fclose(fp);
#   54|       if (!(hOutProfile = cmsOpenProfileFromMem(oprof, size)))

Error: COMPILER_WARNING: [#def54]
LibRaw-0.21.4/src/write/file_write.cpp: scope_hint: In member function 'LibRaw::tiff_head(tiff_hdr*, int)'
LibRaw-0.21.4/src/write/file_write.cpp:78:27: warning[-Wformat-overflow=]: '%02d' directive writing between 2 and 11 bytes into a region of size between 8 and 15
#   78 |   sprintf(th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900,
#      |                           ^~~~
LibRaw-0.21.4/src/write/file_write.cpp:78:21: note: directive argument in the range [-2147483647, 2147483647]
#   78 |   sprintf(th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900,
#      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio2.h:30:34: note: '__sprintf_chk' output between 20 and 72 bytes into a destination of size 20
#   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
#      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   31 |                                   __glibc_objsize (__s), __fmt,
#      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   32 |                                   __va_arg_pack ());
#      |                                   ~~~~~~~~~~~~~~~~~
#   76|     strcpy(th->soft, "dcraw v" DCRAW_VERSION);
#   77|     t = localtime(&timestamp);
#   78|->   sprintf(th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900,
#   79|             t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
#   80|     strncpy(th->t_artist, artist, 64);

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-252.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameLibRaw-0.21.4-1.fc43
store-results-to/tmp/tmpm9gajarl/LibRaw-0.21.4-1.fc43.tar.xz
time-created2025-04-25 12:02:01
time-finished2025-04-25 12:06:02
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpm9gajarl/LibRaw-0.21.4-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpm9gajarl/LibRaw-0.21.4-1.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9