New Defects reported by Coverity Scan for digiKam

scan-admin at coverity.com scan-admin at coverity.com
Thu May 14 18:43:29 BST 2020


Hi,

Please find the latest report on new defect(s) introduced to digiKam found with Coverity Scan.

9 new defect(s) introduced to digiKam found with Coverity Scan.
5 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 9 of 9 defect(s)


** CID 1463565:    (NO_EFFECT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/exif_gps.cpp: 94 in LibRaw::parse_exif(int)()
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/exif_gps.cpp: 96 in LibRaw::parse_exif(int)()


________________________________________________________________________________________________________
*** CID 1463565:    (NO_EFFECT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/exif_gps.cpp: 94 in LibRaw::parse_exif(int)()
88     		fseek(ifp, get4() + base, SEEK_SET);
89     		parse_exif_interop(base);
90     		break;
91     	case 0xA001: // ExifIFD.ColorSpace
92     		c = get2();
93     		if (c == 1 && imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_Unknown)
>>>     CID 1463565:    (NO_EFFECT)
>>>     The boolean test in statement "this->imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_sRGB;" has no effect.
94     			imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_sRGB;
95     		else if (c == 2)
96     			imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_AdobeRGB;
97     		break;
98         case 0x9400:
99           imCommon.exifAmbientTemperature = getreal(type);
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/exif_gps.cpp: 96 in LibRaw::parse_exif(int)()
90     		break;
91     	case 0xA001: // ExifIFD.ColorSpace
92     		c = get2();
93     		if (c == 1 && imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_Unknown)
94     			imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_sRGB;
95     		else if (c == 2)
>>>     CID 1463565:    (NO_EFFECT)
>>>     The boolean test in statement "this->imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_AdobeRGB;" has no effect.
96     			imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_AdobeRGB;
97     		break;
98         case 0x9400:
99           imCommon.exifAmbientTemperature = getreal(type);
100           if ((imCommon.CameraTemperature > -273.15f) &&
101               ((OlyID == OlyID_TG_5) ||

** CID 1463564:  Control flow issues  (DEADCODE)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/samples/raw-identify.cpp: 893 in print_jsonfun(_IO_FILE *, LibRaw &, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, int, int)()


________________________________________________________________________________________________________
*** CID 1463564:  Control flow issues  (DEADCODE)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/samples/raw-identify.cpp: 893 in print_jsonfun(_IO_FILE *, LibRaw &, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, int, int)()
887         n_tabs*tab_width, tab_char);
888     
889       if (C.cam_mul[0]) {
890         if (!data_present) {
891           fprintf (outfile, "{");
892           n_tabs++;
>>>     CID 1463564:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "fprintf(outfile, ",");".
893         } else fprintf (outfile, ",");
894         fprintf (outfile, "\n%*c\"%s\":",
895           n_tabs*tab_width, tab_char, WB_idx2str(LIBRAW_WBI_AsShot));
896         for (int i = 0; i < 4; i++) {
897           fprintf (outfile, "%s%g%s", (!i)?"[":"",
898             C.cam_mul[i], (i < 3)?",":"]");

** CID 1463563:  Memory - corruptions  (OVERRUN)


________________________________________________________________________________________________________
*** CID 1463563:  Memory - corruptions  (OVERRUN)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/samples/raw-identify.cpp: 1291 in print_verbose(_IO_FILE *, LibRaw &, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &)()
1285     
1286     	fprintf(outfile, "Image size:  %4d x %d\n", S.width, S.height);
1287     	fprintf(outfile, "Output size: %4d x %d\n", S.iwidth, S.iheight);
1288     	fprintf(outfile, "Image flip: %d\n", S.flip);
1289     
1290     	if (Canon.RecordMode) {
>>>     CID 1463563:  Memory - corruptions  (OVERRUN)
>>>     Overrunning array "CanonRecordModes" of 15 16-byte elements by passing it to a function which accesses it at element index 15 (byte offset 255) using argument "LIBRAW_Canon_RecordMode_TheLastOne".
1291     	  id2hr_t *RecordMode =
1292     	    lookup_id2hr(Canon.RecordMode, CanonRecordModes, nCanonRecordModes);
1293     	  fprintf(outfile, "Canon record mode: %d, %s\n", Canon.RecordMode, RecordMode->name);
1294     	}
1295     	if (Canon.SensorWidth)
1296     		fprintf(outfile, "SensorWidth          = %d\n", Canon.SensorWidth);

** CID 1463562:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/tiff.cpp: 1681 in ()


________________________________________________________________________________________________________
*** CID 1463562:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/tiff.cpp: 1681 in ()
1675               continue; // SKIP RGB+Alpha IFDs
1676     
1677           if ((tiff_ifd[i].comp != 6 || tiff_ifd[i].samples != 3) &&
1678                 unsigned(tiff_ifd[i].t_width | tiff_ifd[i].t_height) < 0x10000 &&
1679                 (unsigned)tiff_ifd[i].bps < 33 &&
1680                 (unsigned)tiff_ifd[i].samples < 13 && ns &&
>>>     CID 1463562:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
>>>     use of "=" where "==" may have been intended
1681                 ((ns > os && (ties = 1)) || (ns == os && shot_select == ties++)))
1682             {
1683             raw_width = tiff_ifd[i].t_width;
1684             raw_height = tiff_ifd[i].t_height;
1685             tiff_bps = tiff_ifd[i].bps;
1686             tiff_compress = tiff_ifd[i].comp;

** CID 1463561:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/identify.cpp: 2274 in ()


________________________________________________________________________________________________________
*** CID 1463561:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/identify.cpp: 2274 in ()
2268     	}
2269     	else if (makeIs(LIBRAW_CAMERAMAKER_Minolta)) {
2270     		if (fsize == 5869568) { // hack Minolta "DiMAGE Z2"
2271     			load_flags = 30;
2272     		}
2273     
>>>     CID 1463561:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
>>>     use of "=" where "==" may have been intended
2274     		if (!load_raw && (maximum = 0xfff))
2275     		{
2276     			load_raw = &LibRaw::unpacked_load_raw;
2277     		}
2278     		if (!strncmp(model, "DiMAGE A",
2279     			8)) // Minolta "DiMAGE A1", "DiMAGE A2", "DiMAGE A200"

** CID 1463560:    (OVERRUN)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/fuji.cpp: 648 in LibRaw::parseAdobeRAFMakernote()()
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/fuji.cpp: 649 in LibRaw::parseAdobeRAFMakernote()()


________________________________________________________________________________________________________
*** CID 1463560:    (OVERRUN)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/fuji.cpp: 648 in LibRaw::parseAdobeRAFMakernote()()
642                 posWB += 4;
643                 wb[2] = sget4(PrivateMknBuf + posWB) << 1;
644                 posWB += 4;
645     
646                 if (tWB && (iCCT < 255))
647                 {
>>>     CID 1463560:    (OVERRUN)
>>>     Overrunning array "this->imgdata.color.WBCT_Coeffs" of 64 20-byte elements at element index 254 (byte offset 5099) using index "iCCT" (which evaluates to 254).
648                   icWBCCTC[iCCT][0] = tWB;
649                   FORC4 icWBCCTC[iCCT][c + 1] = wb[c];
650                   iCCT++;
651                 }
652                 if (nWB != 0x46)
653                 {
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/fuji.cpp: 649 in LibRaw::parseAdobeRAFMakernote()()
643                 wb[2] = sget4(PrivateMknBuf + posWB) << 1;
644                 posWB += 4;
645     
646                 if (tWB && (iCCT < 255))
647                 {
648                   icWBCCTC[iCCT][0] = tWB;
>>>     CID 1463560:    (OVERRUN)
>>>     Overrunning array "this->imgdata.color.WBCT_Coeffs" of 64 20-byte elements at element index 254 (byte offset 5099) using index "iCCT" (which evaluates to 254).
649                   FORC4 icWBCCTC[iCCT][c + 1] = wb[c];
650                   iCCT++;
651                 }
652                 if (nWB != 0x46)
653                 {
654                   for (pWB = 1; pWB < nFuji_wb_list2; pWB += 2)

** CID 1463559:  Incorrect expression  (NO_EFFECT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/samples/raw-identify.cpp: 1379 in print_verbose(_IO_FILE *, LibRaw &, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &)()


________________________________________________________________________________________________________
*** CID 1463559:  Incorrect expression  (NO_EFFECT)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/samples/raw-identify.cpp: 1379 in print_verbose(_IO_FILE *, LibRaw &, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &)()
1373     		}
1374     
1375     		for (int cnt = 0; cnt < (sizeof WBToStr / sizeof *WBToStr); cnt++) {
1376     			WBi = WBToStr[cnt].NumId;
1377     			if ((C.WB_Coeffs[WBi][0] > 0) && (C.WB_Coeffs[WBi][1] > 0)) {
1378             denom = (float)C.WB_Coeffs[WBi][1];
>>>     CID 1463559:  Incorrect expression  (NO_EFFECT)
>>>     Comparing an array to null is not useful: "MyCoolRawProcessor.imgdata.color.WB_Coeffs[3]", since the test will always evaluate as true.
1379             fprintf(outfile, "\n  %-23s   %4d %4d %4d %4d   %5.2f %5.2f %5.2f %5.2f",
1380     		            WBToStr[cnt].hrStrId,
1381     		            C.WB_Coeffs[WBi][0], C.WB_Coeffs[WBi][1], C.WB_Coeffs[WBi][2], C.WB_Coeffs[WBi][3],
1382     		            roundf(log2((float)C.WB_Coeffs[WBi][0] / denom)*100.0f)/100.0f,
1383     		            0.0f,
1384     		            roundf(log2((float)C.WB_Coeffs[WBi][2] / denom)*100.0f)/100.0f,

** CID 1463558:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/home/gilles/Documents/GIT/7.x/core/libs/dimg/dimg_data.cpp: 173 in Digikam::DImg::allocateData() const()


________________________________________________________________________________________________________
*** CID 1463558:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/home/gilles/Documents/GIT/7.x/core/libs/dimg/dimg_data.cpp: 173 in Digikam::DImg::allocateData() const()
167     size_t DImg::allocateData() const
168     {
169         quint64 size = (quint64)m_priv->width  *
170                        (quint64)m_priv->height *
171                        (quint64)(m_priv->sixteenBit ? 8 : 4);
172     
>>>     CID 1463558:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "size > 18446744073709551615ULL /* (quint64)std::numeric_limits<unsigned long>::max() */" is always false regardless of the values of its operands. This occurs as the logical operand of "if".
173         if (size > (quint64)std::numeric_limits<size_t>::max())
174         {
175             m_priv->null = true;
176     
177             return 0;
178         }

** CID 1375955:  Memory - illegal accesses  (NEGATIVE_RETURNS)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/ciff.cpp: 461 in LibRaw::parse_ciff(int, int, int)()


________________________________________________________________________________________________________
*** CID 1375955:  Memory - illegal accesses  (NEGATIVE_RETURNS)
/home/gilles/Documents/GIT/7.x/core/libs/rawengine/libraw/src/metadata/ciff.cpp: 461 in LibRaw::parse_ciff(int, int, int)()
455                   UseWBfromTable_as_AsShot==0?"no":"yes", Got_AsShotWB==0?"no":"yes");
456                 break;
457               }
458             }
459     #endif
460     
>>>     CID 1375955:  Memory - illegal accesses  (NEGATIVE_RETURNS)
>>>     Using variable "wbi" as an index to array "LibRaw::Canon_wbi2std".
461             if ((Canon_wbi2std[wbi] == LIBRAW_WBI_Auto)    ||
462                 (Canon_wbi2std[wbi] == LIBRAW_WBI_Unknown) ||
463                 Got_AsShotWB)
464               UseWBfromTable_as_AsShot = 0;
465     
466             if (UseWBfromTable_as_AsShot) {


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/ls/click?upn=nJaKvJSIH-2FPAfmty-2BK5tYpPklAc1eEA-2F1zfUjH6teExFxByfkNnczn62-2Fi7fqgWZX-2BbNxhtyL5c9g-2BPgAq7MT77OPXJ5d6pc1EDZ78vhX68-3D_sKz_IpEMwFcbl-2BY9RHaL2m6a3nuAxB4hfm4MTniX0gHjADVqj4jYDV-2B7h2RCWMNHxM1cJ02MUYtVytt677r-2Fp8NbOElBnJs2-2B9WAbaBa0nTU7zYM7xIoam2ZpFdG-2FDQrUL-2FLmr8er5of0Kq2LU9lB0WTEIO9mer-2F1AOXDfhpUWR-2Fut-2BPCNwZ-2FdMZIxXcS7wee00-2FgIeyf79d-2FDD8epT-2FHFrxeYiUI4sfHQnZFpnNiuA58v1jndCDzQPoz9QMp2gCoif6



More information about the Digikam-devel mailing list