Newly introduced defects

List of Defects

Error: CLANG_WARNING: [#def1]
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gpmisc.c:1172:17: warning[deadcode.DeadStores]: Value stored to 'code' is never read
# 1170|               newbuffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, newlen + 1, "gp_validate_path");
# 1171|               if (newbuffer == NULL) {
# 1172|->                 code = gs_note_error(gs_error_VMerror);
# 1173|                   goto exit;
# 1174|               }

Error: CLANG_WARNING: [#def2]
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gpmisc.c:1182:17: warning[deadcode.DeadStores]: Value stored to 'code' is never read
# 1180|               gs_free_object(mem->thread_safe_memory, newbuffer, "gp_validate_path");
# 1181|               if (code != gp_combine_success) {
# 1182|->                 code = gs_note_error(gs_error_invalidfileaccess);
# 1183|                   goto exit;
# 1184|               }

Error: CLANG_WARNING: [#def3]
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gdevmpla.c:20: included_from: Included from here.
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gsbitops.h:411:29: warning[core.UndefinedBinaryOperatorResult]: The left operand of '&' is a garbage value
#  409|   {
#  410|     if (dbit != 0 )\
#  411|->     *dptr = dbbyte | (*dptr & (0xff >> dbit));
#  412|   }
#  413|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gx.h:23: included_from: Included from here.
ghostscript-10.03.1-build/ghostscript-10.03.1/contrib/opvp/gdevopvp.c:46: included_from: Included from here.
ghostscript-10.03.1-build/ghostscript-10.03.1/contrib/opvp/gdevopvp.c: scope_hint: In function ‘_put_params’
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gserrors.h:140:41: warning[-Wanalyzer-malloc-leak]: leak of ‘buff’
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gserrors.h:142:28: note: in expansion of macro ‘gs_log_error’
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gserrors.h:143:34: note: in expansion of macro ‘gs_note_error’
ghostscript-10.03.1-build/ghostscript-10.03.1/contrib/opvp/gdevopvp.c:3463:13: note: in expansion of macro ‘return_error’
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gserrors.h:142:28: note: in expansion of macro ‘gs_log_error’
ghostscript-10.03.1-build/ghostscript-10.03.1/base/gserrors.h:143:34: note: in expansion of macro ‘gs_note_error’
ghostscript-10.03.1-build/ghostscript-10.03.1/contrib/opvp/gdevopvp.c:3463:13: note: in expansion of macro ‘return_error’
#  138|   int gs_log_error(int, const char *, int);
#  139|   #if !defined(DEBUG)
#  140|-> #  define gs_log_error(err, file, line) (err)
#  141|   #endif
#  142|   #define gs_note_error(err) gs_log_error(err, __FILE__, __LINE__)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
ghostscript-10.03.1-build/ghostscript-10.03.1/base/stream.c: scope_hint: In function ‘stream_compact’
ghostscript-10.03.1-build/ghostscript-10.03.1/base/stream.c:1015:9: warning[-Wanalyzer-null-argument]: use of NULL ‘*s.cbuf_string.data’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memmove’ must be non-null
# 1013|           uint dist = s->cursor.r.ptr + 1 - s->cbuf;
# 1014|   
# 1015|->         memmove(s->cbuf, s->cursor.r.ptr + 1,
# 1016|                   (uint) (s->cursor.r.limit - s->cursor.r.ptr));
# 1017|           s->cursor.r.ptr = s->cbuf - 1;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
ghostscript-10.03.1-build/ghostscript-10.03.1/contrib/opvp/gdevopvp.c:3631:9: warning[-Wanalyzer-null-argument]: use of NULL ‘buff’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
# 3629|       case 0:
# 3630|           buff = realloc(buff, zmps.size + 1);
# 3631|->         memcpy(buff, zmps.data, zmps.size);
# 3632|           buff[zmps.size] = 0;
# 3633|           if (strncasecmp(buff, "Auto", 4)) {

Error: CPPCHECK_WARNING (CWE-758): [#def7]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdf.c:1713: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour
# 1711|   
# 1712|               if (!pdev->doubleXref || objstm == 0) {
# 1713|->                 if (pos & ASIDES_BASE_POSITION)
# 1714|                       pos += resource_pos - ASIDES_BASE_POSITION;
# 1715|                   pos -= pdev->OPDFRead_procset_length;

Error: CPPCHECK_WARNING (CWE-758): [#def8]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdf.c:1714: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour
# 1712|               if (!pdev->doubleXref || objstm == 0) {
# 1713|                   if (pos & ASIDES_BASE_POSITION)
# 1714|->                     pos += resource_pos - ASIDES_BASE_POSITION;
# 1715|                   pos -= pdev->OPDFRead_procset_length;
# 1716|   

Error: CLANG_WARNING: [#def9]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdf.c:3341:13: warning[deadcode.DeadStores]: Value stored to 'length' is never read
# 3339|                   end_section++;
# 3340|   
# 3341|->             length += (end_section - start_section) * (offs_bytes + 3);
# 3342|   
# 3343|               if (pdev->FirstObjectNumber == 1) {

Error: CLANG_WARNING: [#def10]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdfi.c:2328:51: warning[core.NullDereference]: Dereference of null pointer
# 2326|           if (DoMatte) {
# 2327|               code = cos_dict_put_c_key_floats((gx_device_pdf *)dev,
# 2328|->                                     (cos_dict_t *)pmie->writer.pres->object,
# 2329|                                       "/Matte", pixm->Matte,
# 2330|                                       num_components);

Error: CLANG_WARNING: [#def11]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdfu.c:1742:57: warning[core.NullDereference]: Array access (via field 'ObjStmOffsets') results in a null pointer dereference
# 1740|           pdev->strm = pdev->ObjStm.strm;
# 1741|           code = pdf_open_obj(pdev, id, type);
# 1742|->         pdev->ObjStmOffsets[pdev->NumObjStmObjects * 2] = code;
# 1743|           pdev->ObjStmOffsets[(pdev->NumObjStmObjects * 2) + 1] = pdf_stell(pdev);
# 1744|       }

Error: CLANG_WARNING: [#def12]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdfv.c:963:29: warning[deadcode.DeadStores]: Although the value stored to 'flag' is used in the enclosing expression, the value is never actually read from 'flag'
#  961|               case shading_type_Free_form_Gouraud_triangle:
#  962|                   {
#  963|->                     while ((flag = shade_next_flag(&cs, 0)) >= 0){
#  964|                           code = cs.get_decoded(&cs, 0, NULL, &x);
#  965|                           if (code < 0)

Error: CPPCHECK_WARNING (CWE-758): [#def13]
ghostscript-10.03.1-build/ghostscript-10.03.1/devices/vector/gdevpdtt.c:3114: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 3112|           if (penum->current_font->FontType == ft_PDF_user_defined) {
# 3113|               if (!pdev->Scaled_accumulator) {
# 3114|->                 if (pdev->width > max_int / 100 || pdev->height > max_int / 100)
# 3115|                       return_error(gs_error_rangecheck);
# 3116|                   pdev->width *= 100;

Error: CLANG_WARNING: [#def14]
ghostscript-10.03.1-build/ghostscript-10.03.1/pdf/pdf_fmap.c:681:9: warning[deadcode.DeadStores]: Value stored to 'code' is never read
#  679|       code = sgets(sf, magic, 4, &nread);
#  680|       if (code < 0 || nread < 4) {
#  681|->         code = 0;
#  682|           sfclose(sf);
#  683|           return 0;

Error: CLANG_WARNING: [#def15]
ghostscript-10.03.1-build/ghostscript-10.03.1/pdf/pdf_fmap.c:688:9: warning[deadcode.DeadStores]: Value stored to 'code' is never read
#  686|       code = sfseek(sf, 0, SEEK_SET);
#  687|       if (code < 0) {
#  688|->         code = 0;
#  689|           sfclose(sf);
#  690|           return 0;

Error: CLANG_WARNING: [#def16]
ghostscript-10.03.1-build/ghostscript-10.03.1/pdf/pdf_fmap.c:751:9: warning[deadcode.DeadStores]: Value stored to 'code' is never read
#  749|           if (code == gs_error_VMerror)
#  750|               break;
#  751|->         code = 0;
#  752|       }
#  753|   done:

Error: CLANG_WARNING: [#def17]
ghostscript-10.03.1-build/ghostscript-10.03.1/pdf/pdf_font.c:1058:21: warning[deadcode.DeadStores]: Value stored to 'code' is never read
# 1056|                       gs_free_object(ctx->memory, fbuf, "pdfi_load_font(fbuf)");
# 1057|                       fbuf = NULL;
# 1058|->                     code = gs_note_error(gs_error_invalidfont);
# 1059|                   }
# 1060|               }

Error: CLANG_WARNING: [#def18]
ghostscript-10.03.1-build/ghostscript-10.03.1/pdf/pdf_font.c:1682:5: warning[deadcode.DeadStores]: Value stored to 'code' is never read
# 1680|       if (ind != NULL) *ind = (gs_encoding_index_t)code;
# 1681|       gs_encoding = (unsigned char)code;
# 1682|->     code = 0;
# 1683|   
# 1684|       for (i = 0;i<256;i++) {

Error: CLANG_WARNING: [#def19]
ghostscript-10.03.1-build/ghostscript-10.03.1/pdf/pdf_font.c:2023:5: warning[deadcode.DeadStores]: Value stored to 'code' is never read
# 2021|       pdfi_cid_subst_nwp_table_t *substnwp = pcidfont->substnwp;
# 2022|   
# 2023|->     code = gs_error_undefined;
# 2024|       while (1) { /* Loop to make retrying with a substitute CID easier */
# 2025|           /* Favour the ToUnicode if one exists */

Error: COMPILER_WARNING: [#def20]
ghostscript-10.03.1-build/ghostscript-10.03.1/psi/iutil.c: scope_hint: In function ‘obj_cvp’
ghostscript-10.03.1-build/ghostscript-10.03.1/psi/iutil.c:540:5: warning[-Wundef]: "DEBUG" is not defined, evaluates to 0
#  540 | #if DEBUG
#      |     ^~~~~
#  538|           }
#  539|           /* Internal operator, no name. */
#  540|-> #if DEBUG
#  541|           gs_snprintf(buf, sizeof(buf), "@"PRI_INTPTR, (intptr_t) op->value.opproc);
#  542|   #else

Error: CPPCHECK_WARNING (CWE-758): [#def21]
ghostscript-10.03.1-build/ghostscript-10.03.1/psi/zarith.c:467: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour
#  465|               else {
#  466|                   if (op->value.intval == MIN_PS_INT)
#  467|->                     make_real(op, -(float)MIN_PS_INT);
#  468|                   else
#  469|                       op->value.intval = -op->value.intval;

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-184.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-nameghostscript-10.02.1-8.fc40
diffbase-store-results-to/tmp/tmpmjhsfgrs/ghostscript-10.02.1-8.fc40.tar.xz
diffbase-time-created2024-07-03 12:45:33
diffbase-time-finished2024-07-03 12:59:07
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpmjhsfgrs/ghostscript-10.02.1-8.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpmjhsfgrs/ghostscript-10.02.1-8.fc40.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-184.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameghostscript-10.03.1-2.fc41
store-results-to/tmp/tmpvn05j0pi/ghostscript-10.03.1-2.fc41.tar.xz
time-created2024-07-03 12:59:35
time-finished2024-07-03 13:12:46
titleNewly introduced defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpvn05j0pi/ghostscript-10.03.1-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpvn05j0pi/ghostscript-10.03.1-2.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9