Task #131069 - hexedit-1.6-11.fc45/scan-results.err

back to task #131069
download
Error: COMPILER_WARNING (CWE-563):
hexedit-1.6/display.c: scope_hint: In function ‘initCurses’
hexedit-1.6/display.c:106:20: warning[-Wunused-variable]: unused variable ‘sa’
#  106 |   struct sigaction sa;
#      |                    ^~
#  104|   void initCurses(void)
#  105|   {
#  106|->   struct sigaction sa;
#  107|     initscr();
#  108|   

Error: COMPILER_WARNING:
hexedit-1.6/display.c:17: included_from: Included from here.
hexedit-1.6/display.c: scope_hint: In function ‘display’
hexedit-1.6/display.c:179:13: warning[-Wformat=]: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’
#  179 |     PRINTW(("%08lX", (int) (base + i)));
#      |             ^~~~~~~  ~~~~~~~~~~~~~~~~
#      |                      |
#      |                      int
hexedit-1.6/hexedit.h:54:97: note: in definition of macro ‘ATTRPRINTW’
#   54 | #define ATTRPRINTW(attr, a) do { if (oldattr != (attr)) attrset(attr), oldattr = (attr); printw a; } while (0)
#      |                                                                                                 ^
hexedit-1.6/display.c:179:5: note: in expansion of macro ‘PRINTW’
#  179 |     PRINTW(("%08lX", (int) (base + i)));
#      |     ^~~~~~
hexedit-1.6/display.c:179:18: note: format string is defined here
#  179 |     PRINTW(("%08lX", (int) (base + i)));
#      |              ~~~~^
#      |                  |
#      |                  long unsigned int
#      |              %08X
#  177|       for (j = 0; j < colsUsed; j++) printw(" "); /* cleanup the line */
#  178|       move(i / lineLength, 0);
#  179|->     PRINTW(("%08lX", (int) (base + i)));
#  180|     }
#  181|   

Error: COMPILER_WARNING:
hexedit-1.6/display.c:192:14: warning[-Wformat=]: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long long int’
#  192 |   printw("--%i%%", fsize == 0 ? 0 : 100 * (base + cursor + fsize/200) / fsize );
#      |             ~^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#      |              |                    |
#      |              int                  long long int
#      |             %lli
#  190|     fsize = getfilesize();
#  191|     if (MAX(fileSize, lastEditedLoc)) printw("/0x%llX", fsize);
#  192|->   printw("--%i%%", fsize == 0 ? 0 : 100 * (base + cursor + fsize/200) / fsize );
#  193|     if (mode == bySector) printw("--sector %lld", (long long) ((base + cursor) / SECTOR_SIZE));
#  194|   

Error: COMPILER_WARNING:
hexedit-1.6/display.c: scope_hint: In function ‘displayLine’
hexedit-1.6/display.c:204:11: warning[-Wformat=]: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’
#  204 |   PRINTW(("%08lX   ", (int) (base + offset)));
#      |           ^~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~
#      |                       |
#      |                       int
hexedit-1.6/hexedit.h:54:97: note: in definition of macro ‘ATTRPRINTW’
#   54 | #define ATTRPRINTW(attr, a) do { if (oldattr != (attr)) attrset(attr), oldattr = (attr); printw a; } while (0)
#      |                                                                                                 ^
hexedit-1.6/display.c:204:3: note: in expansion of macro ‘PRINTW’
#  204 |   PRINTW(("%08lX   ", (int) (base + offset)));
#      |   ^~~~~~
hexedit-1.6/display.c:204:16: note: format string is defined here
#  204 |   PRINTW(("%08lX   ", (int) (base + offset)));
#      |            ~~~~^
#      |                |
#      |                long unsigned int
#      |            %08X
#  202|     mark_color = COLOR_PAIR(4) | A_BOLD;
#  203|   #endif
#  204|->   PRINTW(("%08lX   ", (int) (base + offset)));
#  205|     for (i = offset; i < offset + lineLength; i++) {
#  206|       if (i > offset) MAXATTRPRINTW(bufferAttr[i] & MARKED, (((i - offset) % blocSize) ? " " : "  "));

Error: GCC_ANALYZER_WARNING (CWE-688):
hexedit-1.6/misc.c:91:10: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘p’ where non-null expected
hexedit-1.6/misc.c:90:13: acquire_memory: this call could return NULL
hexedit-1.6/misc.c:91:6: branch_true: following ‘true’ branch (when ‘a’ is non-NULL)...
hexedit-1.6/misc.c:91:10: branch_true: ...to here
hexedit-1.6/misc.c:91:10: danger: argument 1 (‘p’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#   89|     size_t lc = c ? strlen(c) : 0;
#   90|     char *p = malloc(la + lb + lc + 1);
#   91|->   if (a) memcpy(p, a, la);
#   92|     if (b) memcpy(p + la, b, lb);
#   93|     if (c) memcpy(p + la + lb, c, lc);

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/misc.c:93: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   91|     if (a) memcpy(p, a, la);
#   92|     if (b) memcpy(p + la, b, lb);
#   93|->   if (c) memcpy(p + la + lb, c, lc);
#   94|     p[la + lb + lc] = '\0';
#   95|     return p;

Error: CPPCHECK_WARNING (CWE-476):
hexedit-1.6/misc.c:94: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: p
#   92|     if (b) memcpy(p + la, b, lb);
#   93|     if (c) memcpy(p + la + lb, c, lc);
#   94|->   p[la + lb + lc] = '\0';
#   95|     return p;
#   96|   }

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/page.c:83: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   81|         max = p->base + p->size;
#   82|         s = malloc(max - min);
#   83|->       memcpy(s + q->base - min, q->vals, q->size);
#   84|         memcpy(s + base - min, vals, size);
#   85|         memcpy(s + p->base - min, p->vals, p->size);

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/page.c:84: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   82|         s = malloc(max - min);
#   83|         memcpy(s + q->base - min, q->vals, q->size);
#   84|->       memcpy(s + base - min, vals, size);
#   85|         memcpy(s + p->base - min, p->vals, p->size);
#   86|         free(q->vals); q->vals = s;

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/page.c:85: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   83|         memcpy(s + q->base - min, q->vals, q->size);
#   84|         memcpy(s + base - min, vals, size);
#   85|->       memcpy(s + p->base - min, p->vals, p->size);
#   86|         free(q->vals); q->vals = s;
#   87|         q->next = p->next;

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/page.c:92: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   90|         max = MAX(q->base + q->size, base + size);
#   91|         s = malloc(max - min);
#   92|->       memcpy(s + q->base - min, q->vals, q->size);
#   93|         memcpy(s + base - min, vals, size);
#   94|         free(q->vals); q->vals = s;

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/page.c:93: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   91|         s = malloc(max - min);
#   92|         memcpy(s + q->base - min, q->vals, q->size);
#   93|->       memcpy(s + base - min, vals, size);
#   94|         free(q->vals); q->vals = s;
#   95|       }

Error: CPPCHECK_WARNING (CWE-476):
hexedit-1.6/page.c:100: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: s
#   98|     } else if (p && base + size == p->base) {
#   99|       unsigned char *s = malloc(p->base + p->size - base);
#  100|->     memcpy(s, vals, size);
#  101|       memcpy(s + p->base - base, p->vals, p->size);
#  102|       free(p->vals); p->vals = s;

Error: GCC_ANALYZER_WARNING (CWE-688):
hexedit-1.6/page.c:100:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘s’ where non-null expected
hexedit-1.6/page.c:63:20: branch_true: following ‘true’ branch (when ‘p’ is non-NULL)...
hexedit-1.6/page.c:64:9: branch_true: ...to here
hexedit-1.6/page.c:75:6: branch_false: following ‘false’ branch (when ‘q’ is NULL)...
hexedit-1.6/page.c:98:13: branch_false: ...to here
hexedit-1.6/page.c:98:13: branch_true: following ‘true’ branch...
hexedit-1.6/page.c:99:24: acquire_memory: this call could return NULL
hexedit-1.6/page.c:100:5: danger: argument 1 (‘s’) from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
#   98|     } else if (p && base + size == p->base) {
#   99|       unsigned char *s = malloc(p->base + p->size - base);
#  100|->     memcpy(s, vals, size);
#  101|       memcpy(s + p->base - base, p->vals, p->size);
#  102|       free(p->vals); p->vals = s;

Error: CPPCHECK_WARNING (CWE-682):
hexedit-1.6/page.c:101: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   99|       unsigned char *s = malloc(p->base + p->size - base);
#  100|       memcpy(s, vals, size);
#  101|->     memcpy(s + p->base - base, p->vals, p->size);
#  102|       free(p->vals); p->vals = s;
#  103|       p->size = p->base + p->size - base;

Error: GCC_ANALYZER_WARNING (CWE-688):
hexedit-1.6/page.c:133:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*<unknown>.vals’ where non-null expected
hexedit-1.6/page.c:114:6: enter_function: entry to ‘removeFromEdited’
hexedit-1.6/page.c:117:20: branch_true: following ‘true’ branch (when ‘p’ is non-NULL)...
hexedit-1.6/page.c:118:9: branch_true: ...to here
hexedit-1.6/page.c:118:8: branch_false: following ‘false’ branch...
hexedit-1.6/page.c:119:8: branch_false: ...to here
hexedit-1.6/page.c:119:8: branch_false: following ‘false’ branch...
hexedit-1.6/page.c:129:26: branch_false: ...to here
hexedit-1.6/page.c:129:15: branch_false: following ‘false’ branch...
hexedit-1.6/page.c:132:32: branch_false: ...to here
hexedit-1.6/page.c:132:11: call_function: calling ‘newPage’ from ‘removeFromEdited’
hexedit-1.6/page.c:132:11: return_function: returning to ‘removeFromEdited’ from ‘newPage’
hexedit-1.6/page.c:133:7: danger: argument 1 (‘*<unknown>.vals’) from [(12)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/11) could be NULL where non-null expected
#  131|       } else {
#  132|         q = newPage(base + size, p->base + p->size - base - size);
#  133|->       memcpy(q->vals, p->vals + base + size - p->base, q->size);
#  134|         q->next = p->next;
#  135|         p->next = q;      

Error: CPPCHECK_WARNING (CWE-476):
hexedit-1.6/page.c:146: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: p
#  144|   { 
#  145|     typePage *p = (typePage *) malloc(sizeof(typePage));
#  146|->   p->base = base;
#  147|     p->size = size;
#  148|     p->vals = malloc(size);

Error: GCC_ANALYZER_WARNING (CWE-476):
hexedit-1.6/page.c:146:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’
hexedit-1.6/page.c:145:30: acquire_memory: this call could return NULL
hexedit-1.6/page.c:146:3: danger: ‘p’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  144|   { 
#  145|     typePage *p = (typePage *) malloc(sizeof(typePage));
#  146|->   p->base = base;
#  147|     p->size = size;
#  148|     p->vals = malloc(size);

Error: CPPCHECK_WARNING (CWE-476):
hexedit-1.6/page.c:147: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: p
#  145|     typePage *p = (typePage *) malloc(sizeof(typePage));
#  146|     p->base = base;
#  147|->   p->size = size;
#  148|     p->vals = malloc(size);
#  149|     return p;

Error: CPPCHECK_WARNING (CWE-476):
hexedit-1.6/page.c:148: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: p
#  146|     p->base = base;
#  147|     p->size = size;
#  148|->   p->vals = malloc(size);
#  149|     return p;
#  150|   }