[Digikam-devel] Fwd: New Defects reported by Coverity Scan for digiKam

Gilles Caulier caulier.gilles at gmail.com
Sun Feb 24 17:15:08 GMT 2013


Hi all,

I just uploaded current whole digiKam git/master implementation to Coverity
SCAN. New reports are available to review...

Best

Gilles Caulier

---------- Forwarded message ----------
From: <scan-admin at coverity.com>
Date: 2013/2/24
Subject: New Defects reported by Coverity Scan for digiKam
To: caulier.gilles at gmail.com
Cc: dvyas at coverity.com



Hi,

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

Defect(s) Reported-by: Coverity Scan
Showing 7 of 73 defects

** CID 986607: Unintended sign extension (SIGN_EXTENSION)
/mnt/devel/GIT/3.x/extra/libkdcraw/libkdcraw/kdcraw.cpp: 410
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986607

** CID 986606: Unintended sign extension (SIGN_EXTENSION)
/mnt/devel/GIT/3.x/extra/libkdcraw/libkdcraw/kdcraw.cpp: 410
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986606

** CID 986605: Unintended sign extension (SIGN_EXTENSION)
/mnt/devel/GIT/3.x/core/libs/dimg/dimgscale.cpp: 2031
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986605

** CID 986604: Unintended sign extension (SIGN_EXTENSION)
/mnt/devel/GIT/3.x/core/libs/dimg/dimgscale.cpp: 1609
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986604

** CID 986603: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
/mnt/devel/GIT/3.x/extra/kipi-plugins/dngconverter/dngwriter/extra/xmp_sdk/common/XML_Node.cpp:
217
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986603

** CID 986602: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
/mnt/devel/GIT/3.x/extra/kipi-plugins/dngconverter/dngwriter/extra/xmp_sdk/XMPCore/XMPUtils.cpp:
704
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986602

** CID 986601: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
/mnt/devel/GIT/3.x/extra/kipi-plugins/dngconverter/dngwriter/extra/xmp_sdk/XMPCore/XMPUtils.cpp:
1090
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=986601


________________________________________________________________________
CID 986607: Unintended sign extension (SIGN_EXTENSION)

/mnt/devel/GIT/3.x/extra/libkdcraw/libkdcraw/kdcraw.cpp: 410 (
sign_extension)
   407        }
   408        else
   409        {
>>> CID 986607: Unintended sign extension (SIGN_EXTENSION)
>>> Suspicious implicit sign extension: "raw.imgdata.sizes.iwidth" with
type "unsigned short" (16 bits, unsigned) is promoted in
"raw.imgdata.sizes.iwidth * raw.imgdata.sizes.iheight" to type "int" (32
bits, signed), then sign-extended to type "unsigned long" (64 bits,
unsigned).  If "raw.imgdata.sizes.iwidth * raw.imgdata.sizes.iheight" is
greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
   410            rawData.resize((int)(raw.imgdata.sizes.iwidth *
raw.imgdata.sizes.iheight * sizeof(unsigned short)));
   411
   412            unsigned short* output = (unsigned short*)rawData.data();
   413
   414            for (uint row = 0; row < raw.imgdata.sizes.iheight; row++)

________________________________________________________________________
CID 986606: Unintended sign extension (SIGN_EXTENSION)

/mnt/devel/GIT/3.x/extra/libkdcraw/libkdcraw/kdcraw.cpp: 410 (
sign_extension)
   407        }
   408        else
   409        {
>>> CID 986606: Unintended sign extension (SIGN_EXTENSION)
>>> Suspicious implicit sign extension: "raw.imgdata.sizes.iheight" with
type "unsigned short" (16 bits, unsigned) is promoted in
"raw.imgdata.sizes.iwidth * raw.imgdata.sizes.iheight" to type "int" (32
bits, signed), then sign-extended to type "unsigned long" (64 bits,
unsigned).  If "raw.imgdata.sizes.iwidth * raw.imgdata.sizes.iheight" is
greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
   410            rawData.resize((int)(raw.imgdata.sizes.iwidth *
raw.imgdata.sizes.iheight * sizeof(unsigned short)));
   411
   412            unsigned short* output = (unsigned short*)rawData.data();
   413
   414            for (uint row = 0; row < raw.imgdata.sizes.iheight; row++)

________________________________________________________________________
CID 986605: Unintended sign extension (SIGN_EXTENSION)

/mnt/devel/GIT/3.x/core/libs/dimg/dimgscale.cpp: 2031 ( sign_extension)
   2028                        if (XAP > 0)
   2029                        {
   2030                            pix = ypoints[dyy + y] + xpoints[x];
>>> CID 986605: Unintended sign extension (SIGN_EXTENSION)
>>> Suspicious implicit sign extension: "(ushort *)pix[2]" with type
"unsigned short" (16 bits, unsigned) is promoted in "(ushort *)pix[2] *
(256 - xapoints[x])" to type "int" (32 bits, signed), then sign-extended to
type "long" (64 bits, signed).  If "(ushort *)pix[2] * (256 - xapoints[x])"
is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
   2031                            r   = R_VAL16(pix) * INV_XAP;
   2032                            g   = G_VAL16(pix) * INV_XAP;
   2033                            b   = B_VAL16(pix) * INV_XAP;
   2034                            a   = A_VAL16(pix) * INV_XAP;
   2035                            ++pix;

________________________________________________________________________
CID 986604: Unintended sign extension (SIGN_EXTENSION)

/mnt/devel/GIT/3.x/core/libs/dimg/dimgscale.cpp: 1609 ( sign_extension)
   1606                        if (XAP > 0)
   1607                        {
   1608                            pix = ypoints[dyy + y] + xpoints[x];
>>> CID 986604: Unintended sign extension (SIGN_EXTENSION)
>>> Suspicious implicit sign extension: "(ushort *)pix[2]" with type
"unsigned short" (16 bits, unsigned) is promoted in "(ushort *)pix[2] *
(256 - xapoints[x])" to type "int" (32 bits, signed), then sign-extended to
type "long" (64 bits, signed).  If "(ushort *)pix[2] * (256 - xapoints[x])"
is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
   1609                            r   = R_VAL16(pix) * INV_XAP;
   1610                            g   = G_VAL16(pix) * INV_XAP;
   1611                            b   = B_VAL16(pix) * INV_XAP;
   1612                            ++pix;
   1613                            r   += R_VAL16(pix) * XAP;

________________________________________________________________________
CID 986603: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)

/mnt/devel/GIT/3.x/extra/kipi-plugins/dngconverter/dngwriter/extra/xmp_sdk/common/XML_Node.cpp:
217 ( printf_arg_mismatch)
   214                  if ( node->nsPrefixLen != 0 ) {
   215                          *buffer += ", prefixLen=";
   216                          char numBuf [20];
>>> CID 986603: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
>>> argument is incompatible with corresponding format string conversion
   217                          snprintf ( numBuf, sizeof(numBuf), "%d",
node->nsPrefixLen );
   218                          *buffer += numBuf;
   219                  }
   220                  *buffer += "\n";
   221

________________________________________________________________________
CID 986602: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)

/mnt/devel/GIT/3.x/extra/kipi-plugins/dngconverter/dngwriter/extra/xmp_sdk/XMPCore/XMPUtils.cpp:
704 ( printf_arg_mismatch)
   701
   702          if ( itemIndex != kXMP_ArrayLastItem ) {
   703                  // AUDIT: Using string->size() for the snprintf
length is safe.
>>> CID 986602: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
>>> argument is incompatible with corresponding format string conversion
   704                  snprintf (
const_cast<char*>(sComposedPath->c_str()), sComposedPath->size(), "%s[%d]",
arrayName, itemIndex );
   705          } else {
   706                  *sComposedPath = arrayName;
   707                  *sComposedPath += "[last()] ";
   708                  (*sComposedPath)[sComposedPath->size()-1] = 0;  //
! Final null is for the strlen at exit.

________________________________________________________________________
CID 986601: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)

/mnt/devel/GIT/3.x/extra/kipi-plugins/dngconverter/dngwriter/extra/xmp_sdk/XMPCore/XMPUtils.cpp:
1090 ( printf_arg_mismatch)
   1087                 // Output YYYY-MM-DD.
   1088                 if ( (tempDate.month < 1) || (tempDate.month > 12)
) XMP_Throw ( "Month is out of range", kXMPErr_BadParam);
   1089                 if ( (tempDate.day < 1) || (tempDate.day > 31) )
XMP_Throw ( "Day is out of range", kXMPErr_BadParam);
>>> CID 986601: Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
>>> argument is incompatible with corresponding format string conversion
   1090                 snprintf ( buffer, sizeof(buffer),
"%.4d-%02d-%02d", tempDate.year, tempDate.month, tempDate.day ); // AUDIT:
Using sizeof for snprintf length is safe.
   1091
   1092         } else {
   1093
   1094                 FormatFullDateTime ( tempDate, buffer,
sizeof(buffer) );

________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan5.coverity.com:8080

If you don't have a username, you can request one by emailing:
scan-admin at coverity.com

To unsubscribe from the email notification for new defects,
http://scan.coverity.com/email_unsubscribe.html
If you are project owner, you can subscribe your team member by accessing
http://scan.coverity.com/email_subscription.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-devel/attachments/20130224/d9c416c0/attachment.html>


More information about the Digikam-devel mailing list