liblouis-3.28.0-6.fc41
List of Defects
Error: CPPCHECK_WARNING: [#def1]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def2]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:80:22: warning[core.UndefinedBinaryOperatorResult]: The right operand of '!=' is a garbage value
# 78| int k;
# 79| for (k = 0; k < len; k++)
# 80|-> if ((widechar)a[k] != b[k]) return 0;
# 81| return 1;
# 82| }
Error: CLANG_WARNING: [#def3]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:312:5: warning[deadcode.DeadStores]: Value stored to 'ch1' is never read
# 310| compileError(file,
# 311| "encoding is neither big-endian, little-endian nor ASCII 8.");
# 312|-> ch1 = EOF;
# 313| break;
# 314| ;
Error: CLANG_WARNING: [#def4]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:442:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 440| _lou_outOfMemory();
# 441| }
# 442|-> memset(((unsigned char *)newTable) + tableSize, 0, newTableSize - tableSize);
# 443| /* update references to the old table */
# 444| {
Error: CLANG_WARNING: [#def5]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:475:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 473| _lou_outOfMemory();
# 474| }
# 475|-> memset(((unsigned char *)newTable) + tableSize, 0, newTableSize - tableSize);
# 476| /* update references to the old table */
# 477| {
Error: CLANG_WARNING: [#def6]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:505:2: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 503| _lou_outOfMemory();
# 504| }
# 505|-> memset(*table, 0, startSize);
# 506| (*table)->tableSize = startSize;
# 507| (*table)->bytesUsed = bytesUsed;
Error: CLANG_WARNING: [#def7]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:524:2: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 522| _lou_outOfMemory();
# 523| }
# 524|-> memset(*table, 0, startSize);
# 525| (*table)->tableSize = startSize;
# 526| (*table)->bytesUsed = bytesUsed;
Error: CLANG_WARNING: [#def8]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:757:4: warning[deadcode.DeadStores]: Value stored to 'IC' is never read
# 755| case pass_groupend:
# 756| case pass_groupreplace:
# 757|-> IC += 3;
# 758|
# 759| NO_CHARACTERS : { return 1; }
Error: CLANG_WARNING: [#def9]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:827:3: warning[deadcode.DeadStores]: Value stored to 'rule' is never read
# 825| character = putChar(file, rule->charsdots[0], table, NULL);
# 826| // putChar may have moved table, so make sure rule is still valid
# 827|-> rule = (TranslationTableRule *)&(*table)->ruleArea[ruleOffset];
# 828| character->compRule = ruleOffset;
# 829| return;
Error: CPPCHECK_WARNING (CWE-457): [#def10]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:1197: warning[uninitvar]: Uninitialized variable: wname
# 1195| int kk;
# 1196| for (kk = 0; kk < length; kk++) wname[kk] = (widechar)characterClassNames[k][kk];
# 1197|-> if (!addCharacterClass(NULL, wname, length, table, 0)) {
# 1198| deallocateCharacterClasses(table);
# 1199| return 0;
Error: CLANG_WARNING: [#def11]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:1597:2: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 1595| _lou_outOfMemory();
# 1596| }
# 1597|-> memset(ruleName, 0, sizeof(*ruleName));
# 1598| // a name is a sequence of characters in the ranges 'a'..'z' and 'A'..'Z'
# 1599| for (k = 0; k < name->length; k++) {
Error: CLANG_WARNING: [#def12]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2452:2: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 2450| HyphenHashTab *hashTab;
# 2451| if (!(hashTab = malloc(sizeof(HyphenHashTab)))) _lou_outOfMemory();
# 2452|-> memset(hashTab, 0, sizeof(HyphenHashTab));
# 2453| return hashTab;
# 2454| }
Error: CLANG_WARNING: [#def13]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2476:10: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'e')
# 2474| i = hyphenStringHash(key) % HYPHENHASHSIZE;
# 2475| if (!(e = malloc(sizeof(HyphenHashEntry)))) _lou_outOfMemory();
# 2476|-> e->next = hashTab->entries[i];
# 2477| e->key = malloc((key->length + 1) * CHARSIZE);
# 2478| if (!e->key) _lou_outOfMemory();
Error: CLANG_WARNING: [#def14]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2477:11: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'CharsString', which is incompatible with sizeof operand type 'widechar'
# 2475| if (!(e = malloc(sizeof(HyphenHashEntry)))) _lou_outOfMemory();
# 2476| e->next = hashTab->entries[i];
# 2477|-> e->key = malloc((key->length + 1) * CHARSIZE);
# 2478| if (!e->key) _lou_outOfMemory();
# 2479| e->key->length = key->length;
Error: CLANG_WARNING: [#def15]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2479:17: warning[core.NullDereference]: Access to field 'length' results in a dereference of a null pointer (loaded from field 'key')
# 2477| e->key = malloc((key->length + 1) * CHARSIZE);
# 2478| if (!e->key) _lou_outOfMemory();
# 2479|-> e->key->length = key->length;
# 2480| for (j = 0; j < key->length; j++) e->key->chars[j] = key->chars[j];
# 2481| e->val = val;
Error: CLANG_WARNING: [#def16]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2509:46: warning[core.NullDereference]: Dereference of null pointer
# 2507| realloc(dict->states, (dict->numStates << 1) * sizeof(HyphenationState));
# 2508| if (!dict->states) _lou_outOfMemory();
# 2509|-> dict->states[dict->numStates].hyphenPattern = 0;
# 2510| dict->states[dict->numStates].fallbackState = DEFAULTSTATE;
# 2511| dict->states[dict->numStates].numTrans = 0;
Error: CLANG_WARNING: [#def17]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2541:12: warning[deadcode.DeadStores]: Value stored to 'k' during its initialization is never read
# 2539| char pattern[MAXSTRING + 1];
# 2540| unsigned int stateNum = 0, lastState = 0;
# 2541|-> int i, j, k = encoding->length;
# 2542| widechar ch;
# 2543| int found;
Error: CLANG_WARNING: [#def18]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2554:31: warning[core.NullDereference]: Dereference of null pointer
# 2552| dict.states = malloc(sizeof(HyphenationState));
# 2553| if (!dict.states) _lou_outOfMemory();
# 2554|-> dict.states[0].hyphenPattern = 0;
# 2555| dict.states[0].fallbackState = DEFAULTSTATE;
# 2556| dict.states[0].numTrans = 0;
Error: COMPILER_WARNING (CWE-1164): [#def19]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2742:1: warning[-Wunused-function]: 'cons_macro' defined but not used
# 2742 | cons_macro(const Macro *head, const MacroList *tail) {
# | ^~~~~~~~~~
# 2740| */
# 2741| static const MacroList *
# 2742|-> cons_macro(const Macro *head, const MacroList *tail) {
# 2743| MacroList *list = malloc(sizeof(MacroList));
# 2744| list->head = head;
Error: COMPILER_WARNING (CWE-1164): [#def20]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c: scope_hint: At top level
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2778:1: warning[-Wunused-function]: 'compileMacro' defined but not used
# 2778 | compileMacro(FileInfo *file, const Macro **macro) {
# | ^~~~~~~~~~~~
# 2776| */
# 2777| static int
# 2778|-> compileMacro(FileInfo *file, const Macro **macro) {
# 2779|
# 2780| // parse name
Error: COMPILER_WARNING (CWE-563): [#def21]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c: scope_hint: In function 'compileRule'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2894:30: warning[-Wunused-variable]: unused variable 'macro'
# 2894 | const Macro *macro;
# | ^~~~~
# 2892| switch (opcode) {
# 2893| case CTO_Macro: {
# 2894|-> const Macro *macro;
# 2895| #ifdef ENABLE_MACROS
# 2896| if (!inScopeMacros) {
Error: CLANG_WARNING: [#def22]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:2999:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'arguments'
# 2997| }
# 2998| if (argument_count < m->argument_count) {
# 2999|-> compileError(file, "Expected %d arguments", m->argument_count);
# 3000| return 0;
# 3001| }
Error: COMPILER_WARNING: [#def23]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c: scope_hint: In function '_lou_defaultTableResolver'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:4641:51: warning[-Wformat-overflow=]: '__sprintf_chk' may write a terminating nul past the end of the destination
# 4641 | sprintf(tableFile, "%s%c%s", dir, DIR_SEP, table);
# | ^
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output 2 or more bytes (assuming 4097) into a destination of size 4096
# 30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 31 | __glibc_objsize (__s), __fmt,
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 32 | __va_arg_pack ());
# | ~~~~~~~~~~~~~~~~~
# 4639| goto failure;
# 4640| }
# 4641|-> sprintf(tableFile, "%s%c%s", dir, DIR_SEP, table);
# 4642| if (stat(tableFile, &info) == 0 && !(info.st_mode & S_IFDIR)) {
# 4643| _lou_logMessage(LOU_LOG_DEBUG, "found table %s", tableFile);
Error: COMPILER_WARNING: [#def24]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c: scope_hint: In function '_lou_defaultTableResolver'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:4653:57: warning[-Wformat-overflow=]: '%s' directive writing up to 4078 bytes into a region of size between 1 and 4079
# 4653 | sprintf(tableFile, "%s%c%s%c%s%c%s", dir, DIR_SEP, "liblouis", DIR_SEP,
# | ^~
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 18 and 8174 bytes into a destination of size 4096
# 30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 31 | __glibc_objsize (__s), __fmt,
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 32 | __va_arg_pack ());
# | ~~~~~~~~~~~~~~~~~
# 4651| goto failure;
# 4652| }
# 4653|-> sprintf(tableFile, "%s%c%s%c%s%c%s", dir, DIR_SEP, "liblouis", DIR_SEP,
# 4654| "tables", DIR_SEP, table);
# 4655| if (stat(tableFile, &info) == 0 && !(info.st_mode & S_IFDIR)) {
Error: CLANG_WARNING: [#def25]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:4693:3: warning[deadcode.DeadStores]: Value stored to 'cp' is never read
# 4691| }
# 4692| #else
# 4693|-> cp += sprintf(cp, ",%s", TABLESDIR);
# 4694| #endif
# 4695| }
Error: CLANG_WARNING: [#def26]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:4744:25: warning[core.NullDereference]: Array access (from variable 'tableFiles') results in a null pointer dereference
# 4742| last = (*cp == '\0');
# 4743| *cp = '\0';
# 4744|-> if (!(tableFiles[k++] = resolveSubtable(subTable, base, searchPath))) {
# 4745| char *path;
# 4746| _lou_logMessage(LOU_LOG_ERROR, "Cannot resolve table '%s'", subTable);
Error: CLANG_WARNING: [#def27]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/compileTranslationTable.c:5151:20: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'newEntry')
# 5149| DisplayTableChainEntry *newEntry = malloc(entrySize);
# 5150| if (!newEntry) _lou_outOfMemory();
# 5151|-> newEntry->next = displayTableChain;
# 5152| newEntry->table = newDisplayTable;
# 5153| newEntry->tableListLength = displayTableListLen;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def28]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/logging.c: scope_hint: In function '_lou_logWidecharBuf'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/logging.c:54:58: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'logMsg'
# 52| else
# 53| formatString = "0x%08X ";
# 54|-> for (i = 0; i < (int)strlen(msg); i++) logMsg[i] = msg[i];
# 55| p += strlen(msg);
# 56| for (i = 0; i < wlen; i++) {
Error: CPPCHECK_WARNING: [#def29]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def30]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c:269:3: warning[core.uninitialized.ArraySubscript]: Array subscript is undefined
# 267| break;
# 268| }
# 269|-> passPosMapping[realInlen] = output.length;
# 270| if (passPosMapping == posMapping) {
# 271| passPosMapping = posMapping2;
Error: COMPILER_WARNING (CWE-457): [#def31]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c: scope_hint: In function '_lou_backTranslate'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c:269:31: warning[-Wmaybe-uninitialized]: 'realInlen' may be used uninitialized
# 269 | passPosMapping[realInlen] = output.length;
# | ^
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c:251:21: note: 'realInlen' was declared here
# 251 | int realInlen;
# | ^~~~~~~~~
# 267| break;
# 268| }
# 269|-> passPosMapping[realInlen] = output.length;
# 270| if (passPosMapping == posMapping) {
# 271| passPosMapping = posMapping2;
Error: CLANG_WARNING: [#def32]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c:271:19: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 269| passPosMapping[realInlen] = output.length;
# 270| if (passPosMapping == posMapping) {
# 271|-> passPosMapping = posMapping2;
# 272| if (realInlen < input.length) *inlen = realInlen;
# 273| } else {
Error: COMPILER_WARNING (CWE-457): [#def33]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c:611:13: warning[-Wmaybe-uninitialized]: 'multindRule' may be used uninitialized
# 611 | if (handleMultind(table, currentDotslen, currentOpcode, currentRule, doingMultind,
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 612 | *multindRule))
# | ~~~~~~~~~~~~~
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c: scope_hint: In function '_lou_backTranslate'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_backTranslateString.c:1095:37: note: 'multindRule' was declared here
# 1095 | const TranslationTableRule *multindRule;
# | ^~~~~~~~~~~
# 609| const TranslationTableCharacter *dots = getDots(input->chars[pos], table);
# 610| int tryThis;
# 611|-> if (handleMultind(table, currentDotslen, currentOpcode, currentRule, doingMultind,
# 612| *multindRule))
# 613| return;
Error: CPPCHECK_WARNING: [#def34]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING (CWE-457): [#def35]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:202: error[ctuuninitvar]: Using argument transCharslen that points at uninitialized variable transCharslen
# 200| int *passIC, PassRuleMatch *match, TranslationTableRule **groupingRule,
# 201| widechar *groupingOp) {
# 202|-> int save_transCharslen = *transCharslen;
# 203| const TranslationTableRule *save_transRule = *transRule;
# 204| TranslationTableOpcode save_transOpcode = *transOpcode;
Error: CLANG_WARNING: [#def36]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:202:2: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 200| int *passIC, PassRuleMatch *match, TranslationTableRule **groupingRule,
# 201| widechar *groupingOp) {
# 202|-> int save_transCharslen = *transCharslen;
# 203| const TranslationTableRule *save_transRule = *transRule;
# 204| TranslationTableOpcode save_transOpcode = *transOpcode;
Error: CLANG_WARNING: [#def37]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:358:3: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
# 356| else
# 357| typebuf_temp[k] = typebuf[posMapping[k]];
# 358|-> memcpy(typebuf, typebuf_temp, output->length * sizeof(formtype));
# 359| free(typebuf_temp);
# 360| }
Error: CLANG_WARNING: [#def38]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:1242:4: warning[deadcode.DeadStores]: Value stored to 'goodTrans' is never read
# 1240| if (srcSpacing != NULL) {
# 1241| if (!(destSpacing = _lou_allocMem(alloc_destSpacing, 0, input.length, *outlen)))
# 1242|-> goodTrans = 0;
# 1243| else
# 1244| memset(destSpacing, '*', *outlen);
Error: COMPILER_WARNING (CWE-457): [#def39]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:1293:47: warning[-Wmaybe-uninitialized]: 'realInlen' may be used uninitialized
# 1293 | passPosMapping[output.length] = realInlen;
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:1270:21: note: 'realInlen' was declared here
# 1270 | int realInlen;
# | ^~~~~~~~~
# 1291| break;
# 1292| }
# 1293|-> passPosMapping[output.length] = realInlen;
# 1294| if (passPosMapping == posMapping) {
# 1295| passPosMapping = posMapping2;
Error: CLANG_WARNING: [#def40]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:1295:19: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 1293| passPosMapping[output.length] = realInlen;
# 1294| if (passPosMapping == posMapping) {
# 1295|-> passPosMapping = posMapping2;
# 1296| } else {
# 1297| int *prevPosMapping = posMapping3;
Error: CLANG_WARNING: [#def41]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:1414:21: warning[core.NullDereference]: Array access (from variable 'inputPos') results in a null pointer dereference
# 1412| int outpos;
# 1413| for (outpos = 0; outpos < *outlen; outpos++) {
# 1414|-> int new_inpos = inputPos[outpos];
# 1415| if (new_inpos < inpos) {
# 1416| rv = 0;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def42]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: scope_hint: In function 'hyphenateWord'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:1448:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'prepWord'
# 1446| /* prepWord is of the format ".hello."
# 1447| * hyphens is the length of the word "hello" "00000" */
# 1448|-> prepWord[0] = '.';
# 1449| for (i = 0; i < wordSize; i++) {
# 1450| prepWord[i + 1] = toLowercase(table, getChar(word[i], table));
Error: CPPCHECK_WARNING (CWE-457): [#def43]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:2312: warning[uninitvar]: Uninitialized variable: dots
# 2310| }
# 2311|
# 2312|-> return for_updatePositions(dots, 1, length, 0, pos, input, output, posMapping,
# 2313| cursorPosition, cursorStatus);
# 2314| }
Error: GCC_ANALYZER_WARNING (CWE-457): [#def44]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: scope_hint: In function 'markSyllables'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:2500:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'transOpcode'
# 2498| tryThis++;
# 2499| }
# 2500|-> switch (transOpcode) {
# 2501| case CTO_Always:
# 2502| if (pos >= input->length) return 0;
Error: COMPILER_WARNING (CWE-563): [#def45]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: scope_hint: In function 'resolveEmphasisPassages'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:2913:26: warning[-Wunused-but-set-variable]: variable 'last_word_start' set but not used
# 2913 | int in_word = 0, last_word_start = -1, last_word_end = -1;
# | ^~~~~~~~~~~~~~~
# 2911| unsigned int *wordBuffer) {
# 2912| const TranslationTableOffset *emphRule = table->emphRules[class->rule];
# 2913|-> int in_word = 0, last_word_start = -1, last_word_end = -1;
# 2914| int in_emph_word = 0, last_emph_symbol = -1;
# 2915| int in_pass = 0, last_pass_word_start = -1, last_pass_word_end = -1, pass_start = -1;
Error: CLANG_WARNING: [#def46]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:2925:4: warning[deadcode.DeadStores]: Value stored to 'last_word_start' is never read
# 2923| if (!in_word && wordBuffer[i] & WORD_CHAR) {
# 2924| in_word = 1;
# 2925|-> last_word_start = i;
# 2926| } else /* check if at end of word */
# 2927| if (in_word && !(wordBuffer[i] & WORD_CHAR)) {
Error: CLANG_WARNING: [#def47]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:3644:18: warning[core.UndefinedBinaryOperatorResult]: The left operand of '!=' is a garbage value
# 3642| while (pos <= input->length) { /* the main translation loop */
# 3643| if (pos > 0 && checkCharAttr(input->chars[pos - 1], CTC_Space, table) &&
# 3644|-> (transOpcode != CTO_JoinableWord))
# 3645| lastWord = (LastWord){ pos, output->length, insertEmphasesFrom };
# 3646| if (pos == input->length) break;
Error: COMPILER_WARNING (CWE-457): [#def48]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:3919:36: warning[-Wmaybe-uninitialized]: 'repwordStart' may be used uninitialized
# 3919 | if (posMapping[k] >= repwordStart) {
# | ^
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: scope_hint: In function '_lou_translate'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:3620:13: note: 'repwordStart' was declared here
# 3620 | int repwordStart;
# | ^~~~~~~~~~~~
# 3917| int k;
# 3918| for (k = output->length - 1; k >= 0; k--)
# 3919|-> if (posMapping[k] >= repwordStart) {
# 3920| output->chars[k + dotslen] = output->chars[k];
# 3921| posMapping[k + dotslen] = posMapping[k];
Error: GCC_ANALYZER_WARNING (CWE-476): [#def49]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: scope_hint: In function 'lou_hyphenate'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:4072:54: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'textHyphens'
# 4070|
# 4071| // initialize hyphens array
# 4072|-> for (k = 0; k < textLen; k++) textHyphens[k] = '0';
# 4073| textHyphens[k] = 0;
# 4074|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def50]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:4073:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'textHyphens'
# 4071| // initialize hyphens array
# 4072| for (k = 0; k < textLen; k++) textHyphens[k] = '0';
# 4073|-> textHyphens[k] = 0;
# 4074|
# 4075| // for every word part
Error: COMPILER_WARNING (CWE-457): [#def51]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c: scope_hint: In function 'lou_hyphenate'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:4111:29: warning[-Wmaybe-uninitialized]: 'inputPos' may be used uninitialized
# 4111 | int braillePos = inputPos[k];
# | ^~~~~~~~~~
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/lou_translateString.c:4047:14: note: 'inputPos' was declared here
# 4047 | int *inputPos;
# | ^~~~~~~~
# 4109| int prevPos = -1;
# 4110| for (k = 0; k < textLen; k++) {
# 4111|-> int braillePos = inputPos[k];
# 4112| if (braillePos > inlen || braillePos < 0) break;
# 4113| if (braillePos > prevPos) {
Error: CPPCHECK_WARNING: [#def52]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def53]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c:108:57: warning[core.NullDereference]: Array access (from variable 'rule_string') results in a null pointer dereference
# 106| int l = 0;
# 107| if (rule->nocross)
# 108|-> for (char *c = "nocross "; *c; c++) rule_string[l++] = *c;
# 109| const char *opcode = _lou_findOpcodeName(rule->opcode);
# 110| for (size_t k = 0; k < strlen(opcode); k++) rule_string[l++] = opcode[k];
Error: CLANG_WARNING: [#def54]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c:110:64: warning[core.NullDereference]: Array access (from variable 'rule_string') results in a null pointer dereference
# 108| for (char *c = "nocross "; *c; c++) rule_string[l++] = *c;
# 109| const char *opcode = _lou_findOpcodeName(rule->opcode);
# 110|-> for (size_t k = 0; k < strlen(opcode); k++) rule_string[l++] = opcode[k];
# 111| rule_string[l++] = '\t';
# 112| for (int k = 0; k < rule->charslen; k++) rule_string[l++] = rule->charsdots[k];
Error: CLANG_WARNING: [#def55]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c:111:20: warning[core.NullDereference]: Array access (from variable 'rule_string') results in a null pointer dereference
# 109| const char *opcode = _lou_findOpcodeName(rule->opcode);
# 110| for (size_t k = 0; k < strlen(opcode); k++) rule_string[l++] = opcode[k];
# 111|-> rule_string[l++] = '\t';
# 112| for (int k = 0; k < rule->charslen; k++) rule_string[l++] = rule->charsdots[k];
# 113| rule_string[l++] = '\t';
Error: GCC_ANALYZER_WARNING (CWE-688): [#def56]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c: scope_hint: In function 'printRule.part.0'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c:120:33: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'message' where non-null expected
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
# 118| // if a dot pattern can not be displayed, print an error message
# 119| char *message = (char *)malloc(50 * sizeof(char));
# 120|-> sprintf(message, "ERROR: provide a display rule for dots %s",
# 121| _lou_showDots(&rule->charsdots[rule->charslen + k], 1));
# 122| l = 0;
Error: GCC_ANALYZER_WARNING (CWE-688): [#def57]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c: scope_hint: In function 'find_matching_rules'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c:179:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'data_save' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 177| /* save data */
# 178| data_save = (char *)malloc(text_len * sizeof(char));
# 179|-> memcpy(data_save, data, text_len);
# 180|
# 181| for (k = 0; k < text_len; k++)
Error: GCC_ANALYZER_WARNING (CWE-476): [#def58]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c: scope_hint: In function 'findRelevantRules'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/maketable.c:454:44: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'rules'
# 452| for (k = 0; k < rule->charslen; k++)
# 453| if (rule->charsdots[k] != text[n + k]) goto next_rule;
# 454|-> rules[m++] = rule;
# 455| if (m == rules_len) goto finish;
# 456| next_rule:
Error: CPPCHECK_WARNING: [#def59]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def60]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'list_conj'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:59:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'list'
# 57| if (!list) {
# 58| list = malloc(sizeof(List));
# 59|-> list->head = dup ? dup(x) : x;
# 60| list->free = free;
# 61| list->tail = NULL;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def61]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:65:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'l'
# 63| } else if (!cmp) {
# 64| List *l = malloc(sizeof(List));
# 65|-> l->head = dup ? dup(x) : x;
# 66| l->free = free;
# 67| l->tail = list;
Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:73:33: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(*table.name)'
# 71| List *l2 = NULL;
# 72| while (l1) {
# 73|-> int c = cmp(l1->head, x);
# 74| if (c > 0)
# 75| break;
Error: GCC_ANALYZER_WARNING (CWE-688): [#def63]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:73:33: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*l1.head' where non-null expected
/usr/include/string.h:156:12: note: argument 1 of 'strcmp' must be non-null
# 71| List *l2 = NULL;
# 72| while (l1) {
# 73|-> int c = cmp(l1->head, x);
# 74| if (c > 0)
# 75| break;
Error: GCC_ANALYZER_WARNING (CWE-688): [#def64]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:73:33: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'x' where non-null expected
liblouis-3.28.0-build/liblouis-3.28.0/gnulib/string.h:41: included_from: Included from here.
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:27: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 2 of 'strcmp' must be non-null
# 71| List *l2 = NULL;
# 72| while (l1) {
# 73|-> int c = cmp(l1->head, x);
# 74| if (c > 0)
# 75| break;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def65]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:85:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'l3'
# 83| }
# 84| List *l3 = malloc(sizeof(List));
# 85|-> l3->head = dup ? dup(x) : x;
# 86| l3->free = free;
# 87| l3->tail = l1;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def66]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'list_toArray'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:144:51: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'array'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'list_toArray'
# 142| array = malloc((1 + list_size(list)) * sizeof(void *));
# 143| i = 0;
# 144|-> for (l = list; l; l = l->tail) array[i++] = dup ? dup(l->head) : l->head;
# 145| array[i] = NULL;
# 146| return array;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def67]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:145:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'array'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'list_toArray'
# 143| i = 0;
# 144| for (l = list; l; l = l->tail) array[i++] = dup ? dup(l->head) : l->head;
# 145|-> array[i] = NULL;
# 146| return array;
# 147| }
Error: CPPCHECK_WARNING (CWE-401): [#def68]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:353: error[leakNoVarFunctionCall]: Allocation with malloc, memcpy doesn't release it.
# 351| features =
# 352| list_conj(list_conj(features,
# 353|-> memcpy(malloc(sizeof(f1)), &f1, sizeof(f1)),
# 354| NULL, NULL, (void (*)(void *))feature_free),
# 355| memcpy(malloc(sizeof(f2)), &f2, sizeof(f2)), NULL,
Error: CPPCHECK_WARNING (CWE-401): [#def69]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:355: error[leakNoVarFunctionCall]: Allocation with malloc, memcpy doesn't release it.
# 353| memcpy(malloc(sizeof(f1)), &f1, sizeof(f1)),
# 354| NULL, NULL, (void (*)(void *))feature_free),
# 355|-> memcpy(malloc(sizeof(f2)), &f2, sizeof(f2)), NULL,
# 356| NULL, (void (*)(void *))feature_free);
# 357| } else {
Error: CPPCHECK_WARNING (CWE-401): [#def70]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:362: error[leakNoVarFunctionCall]: Allocation with malloc, memcpy doesn't release it.
# 360| f.feature.key, f.feature.val);
# 361| features =
# 362|-> list_conj(features, memcpy(malloc(sizeof(f)), &f, sizeof(f)),
# 363| NULL, NULL, (void (*)(void *))feature_free);
# 364| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def71]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'widestrToStr'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:418:43: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'widestrToStr'
# 416| char *result = malloc((1 + n) * sizeof(char));
# 417| size_t k;
# 418|-> for (k = 0; k < n; k++) result[k] = (char)str[k];
# 419| result[k] = '\0';
# 420| return result;
Error: CLANG_WARNING: [#def72]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:551:11: warning[deadcode.DeadStores]: Although the value stored to 'features' is used in the enclosing expression, the value is never actually read from 'features'
# 549| f2->feature.val);
# 550| features = list_conj(
# 551|-> features = list_conj(features, f1, NULL, NULL,
# 552| (void (*)(void *))feature_free),
# 553| f2, NULL, NULL, (void (*)(void *))feature_free);
Error: CPPCHECK_WARNING (CWE-401): [#def73]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:619: error[leakNoVarFunctionCall]: Allocation with malloc, memcpy doesn't release it.
# 617| if (features) {
# 618| TableMeta m = { strdup(*table), features };
# 619|-> tableIndex = list_conj(tableIndex, memcpy(malloc(sizeof(m)), &m, sizeof(m)),
# 620| NULL, NULL, free);
# 621| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def74]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c: scope_hint: In function 'listFiles'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:687:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'dirName'
# 685| ;
# 686| dirName = malloc(n + 1);
# 687|-> dirName[n] = '\0';
# 688| memcpy(dirName, &searchPath[pos], n);
# 689| list = listDir(list, dirName);
Error: GCC_ANALYZER_WARNING (CWE-688): [#def75]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:688:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'dirName' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 686| dirName = malloc(n + 1);
# 687| dirName[n] = '\0';
# 688|-> memcpy(dirName, &searchPath[pos], n);
# 689| list = listDir(list, dirName);
# 690| free(dirName);
Error: CPPCHECK_WARNING (CWE-401): [#def76]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:767: error[leakNoVarFunctionCall]: Allocation with malloc, memcpy doesn't release it.
# 765| if (quotient > 0) {
# 766| TableMatch m = { strdup(table->name), quotient };
# 767|-> matches = list_conj(matches, memcpy(malloc(sizeof(m)), &m, sizeof(m)),
# 768| (int (*)(void *, void *))cmpMatches, NULL, free);
# 769| }
Error: CLANG_WARNING: [#def77]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:799:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'value'
# 797| if (lineNumber < 0 || lineNumber > f->lineNumber) {
# 798| value = strdup(f->feature.val);
# 799|-> lineNumber = f->lineNumber;
# 800| }
# 801| } else if (cmp > 0) {
Error: CLANG_WARNING: [#def78]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/metadata.c:817:10: warning[unix.Malloc]: Potential memory leak
# 815| for (l = tableIndex; l; l = l->tail) {
# 816| TableMeta *table = l->head;
# 817|-> tables = list_conj(
# 818| tables, strdup(table->name), (int (*)(void *, void *))strcmp, NULL, NULL);
# 819| }
Error: CPPCHECK_WARNING: [#def79]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/pattern.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: COMPILER_WARNING (CWE-1164): [#def80]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/pattern.c:313:1: warning[-Wunused-function]: 'pattern_output' defined but not used
# 313 | pattern_output(const widechar *expr_data, const TranslationTableHeader *table) {
# | ^~~~~~~~~~~~~~
# 311|
# 312| static void
# 313|-> pattern_output(const widechar *expr_data, const TranslationTableHeader *table) {
# 314| printf("%d \tlength\n", expr_data[0]);
# 315| printf("%d \tloops\n", expr_data[1]);
Error: COMPILER_WARNING (CWE-1164): [#def81]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/pattern.c:435:1: warning[-Wunused-function]: 'pattern_print' defined but not used
# 435 | pattern_print(const widechar *expr_data, const TranslationTableHeader *table) {
# | ^~~~~~~~~~~~~
# 433|
# 434| static void
# 435|-> pattern_print(const widechar *expr_data, const TranslationTableHeader *table) {
# 436| if (expr_data[0] > 0 && expr_data[0] != PTN_END)
# 437| pattern_print_expression(expr_data, 2, table);
Error: COMPILER_WARNING (CWE-1164): [#def82]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/pattern.c:923:1: warning[-Wunused-function]: 'pattern_insert_alternate' defined but not used
# 923 | pattern_insert_alternate(const widechar *input, const int input_max, int *input_crs,
# | ^~~~~~~~~~~~~~~~~~~~~~~~
# 921|
# 922| static int
# 923|-> pattern_insert_alternate(const widechar *input, const int input_max, int *input_crs,
# 924| widechar *expr_data, const int expr_max, widechar *expr_crs, widechar *loop_cnts,
# 925| int expr_insert, TranslationTableHeader *table, const FileInfo *nested) {
Error: GCC_ANALYZER_WARNING (CWE-688): [#def83]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/pattern.c: scope_hint: In function 'pattern_check_hook'
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/pattern.c:1606:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'loop_cnts' where non-null expected
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
# 1604| input_crs = input_start;
# 1605| loop_cnts = malloc(expr_data[1] * sizeof(int));
# 1606|-> memset(loop_cnts, 0, expr_data[1] * sizeof(int));
# 1607| ret = pattern_check_expression(input, &input_crs, input_minmax, input_dir, expr_data,
# 1608| hook, hook_data, hook_max, 2, 0, 0, loop_cnts, table);
Error: CPPCHECK_WARNING: [#def84]
liblouis-3.28.0-build/liblouis-3.28.0/liblouis/utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def85]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: COMPILER_WARNING (CWE-1164): [#def86]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c: scope_hint: At top level
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:61:1: warning[-Wunused-function]: 'print_int_array' defined but not used
# 61 | print_int_array(const char *prefix, int *pos_list, int len) {
# | ^~~~~~~~~~~~~~~
# 59|
# 60| static void
# 61|-> print_int_array(const char *prefix, int *pos_list, int len) {
# 62| int i;
# 63| fprintf(stderr, "%s ", prefix);
Error: GCC_ANALYZER_WARNING (CWE-401): [#def87]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:103:24: warning[-Wanalyzer-malloc-leak]: leak of 'expectedbuf'
# 101| if (in.direction < 0 || in.direction > 1) {
# 102| fprintf(stderr, "Invalid direction.\n");
# 103|-> return 1;
# 104| }
# 105| if (in.direction != 0 && in.typeform != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-401): [#def88]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:103:24: warning[-Wanalyzer-malloc-leak]: leak of 'outbuf'
# 101| if (in.direction < 0 || in.direction > 1) {
# 102| fprintf(stderr, "Invalid direction.\n");
# 103|-> return 1;
# 104| }
# 105| if (in.direction != 0 && in.typeform != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-401): [#def89]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:103:24: warning[-Wanalyzer-malloc-leak]: leak of 'typeformbuf'
# 101| if (in.direction < 0 || in.direction > 1) {
# 102| fprintf(stderr, "Invalid direction.\n");
# 103|-> return 1;
# 104| }
# 105| if (in.direction != 0 && in.typeform != NULL) {
Error: COMPILER_WARNING (CWE-704): [#def90]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c: scope_hint: In function 'check_base'
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:126:35: warning[-Wdiscarded-qualifiers]: passing argument 1 of 'parsed_strlen' discards 'const' qualifier from pointer target type
# 126 | int inlen = parsed_strlen(input);
# | ^~~~~
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:50:21: note: expected 'char *' but argument is of type 'const char *'
# 50 | parsed_strlen(char *s) {
# | ~~~~~~^
# 124| }
# 125| widechar *inbuf, *outbuf, *expectedbuf;
# 126|-> int inlen = parsed_strlen(input);
# 127| int actualInlen;
# 128| const int outlen_multiplier = 4 + sizeof(widechar) * 2;
Error: GCC_ANALYZER_WARNING (CWE-688): [#def91]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:141:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'typeformbuf' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 139| if (in.typeform != NULL) {
# 140| typeformbuf = malloc(outlen * sizeof(formtype));
# 141|-> memcpy(typeformbuf, in.typeform, inlen * sizeof(formtype));
# 142| }
# 143| if (in.cursorPos >= 0) {
Error: CLANG_WARNING: [#def92]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:156:3: warning[unix.Malloc]: Potential leak of memory pointed to by 'expectedbuf'
# 154| }
# 155| if (in.real_inlen > inlen) {
# 156|-> fprintf(stderr,
# 157| "expected realInputLength (%d) may not exceed total input length "
# 158| "(%d)\n",
Error: CLANG_WARNING: [#def93]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:156:3: warning[unix.Malloc]: Potential leak of memory pointed to by 'outbuf'
# 154| }
# 155| if (in.real_inlen > inlen) {
# 156|-> fprintf(stderr,
# 157| "expected realInputLength (%d) may not exceed total input length "
# 158| "(%d)\n",
Error: CLANG_WARNING: [#def94]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:156:3: warning[unix.Malloc]: Potential leak of memory pointed to by 'typeformbuf'
# 154| }
# 155| if (in.real_inlen > inlen) {
# 156|-> fprintf(stderr,
# 157| "expected realInputLength (%d) may not exceed total input length "
# 158| "(%d)\n",
Error: GCC_ANALYZER_WARNING (CWE-476): [#def95]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c: scope_hint: In function 'convert_typeform'
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:342:47: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'typeform'
# 340| formtype *typeform = malloc(len * sizeof(formtype));
# 341| int i;
# 342|-> for (i = 0; i < len; i++) typeform[i] = typeform_string[i] - '0';
# 343| return typeform;
# 344| }
Error: COMPILER_WARNING: [#def96]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c: scope_hint: In function 'check_display'
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:438:18: warning[-Walloc-size-larger-than=]: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807
# 438 | outbuf = malloc(sizeof(widechar) * inlen);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:25: included_from: Included from here.
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/stdlib.h:1044:1: note: in a call to allocation function 'malloc' declared here
# 1044 | _GL_FUNCDECL_SYS (malloc, void *,
# | ^~~~~~~~~~~~~~~~
# 436| }
# 437| }
# 438|-> outbuf = malloc(sizeof(widechar) * inlen);
# 439| if (!lou_charToDots(displayTableList, inbuf, outbuf, inlen, ucBrl)) {
# 440| // This should only happen if the table can not be compiled.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def97]
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c: scope_hint: In function 'check_hyphenation'
liblouis-3.28.0-build/liblouis-3.28.0/tools/brl_checks.c:565:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'hyphenatedbuf'
# 563| int i = 0;
# 564| int j = 0;
# 565|-> hyphenatedbuf[i++] = inbuf[j++];
# 566| for (; j < inlen; j++) {
# 567| if (hyphens[j] == '2')
Error: CPPCHECK_WARNING (CWE-562): [#def98]
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/gettext.h:247: error[returnDanglingLifetime]: Returning pointer to local variable 'msg_ctxt_id' that will be invalid when returning.
# 245| #endif
# 246| if (found_translation)
# 247|-> return translation;
# 248| }
# 249| return msgid;
Error: CLANG_WARNING: [#def99]
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/unistr/u16-to-u8.c:29: included_from: Included from here.
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/unistr.h:320:12: warning[core.NullDereference]: Array access (from variable 's') results in a null pointer dereference
# 318| if (uc < 0x80 && n > 0)
# 319| {
# 320|-> s[0] = uc;
# 321| return 1;
# 322| }
Error: CPPCHECK_WARNING: [#def100]
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/unistr/u16-to-u8.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def101]
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/unistr/u16-to-u8.c:109:13: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
# 107| }
# 108| if (result == resultbuf && length > 0)
# 109|-> memcpy ((char *) memory, (char *) result,
# 110| length * sizeof (DST_UNIT));
# 111| result = memory;
Error: CPPCHECK_WARNING: [#def102]
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/unistr/u32-to-u8.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def103]
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/unistr/u32-to-u8.c:95:13: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
# 93| }
# 94| if (result == resultbuf && length > 0)
# 95|-> memcpy ((char *) memory, (char *) result,
# 96| length * sizeof (DST_UNIT));
# 97| result = memory;
Error: CPPCHECK_WARNING: [#def104]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_allround.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def105]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkhyphens.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def106]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checktable.c:114:8: warning[deadcode.DeadStores]: Although the value stored to 'table' is used in the enclosing expression, the value is never actually read from 'table'
# 112| }
# 113|
# 114|-> if (!(table = lou_getTable(argv[optind]))) {
# 115| lou_free();
# 116| exit(EXIT_FAILURE);
Error: CPPCHECK_WARNING: [#def107]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def108]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_table_query’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:140:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘query_as_string’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:22: included_from: Included from here.
# 138| char *query_as_string = malloc(sizeof(char) * MAXSTRING);
# 139| char *p = query_as_string;
# 140|-> query_as_string[0] = '\0';
# 141| while (1) {
# 142| if (!yaml_parser_parse(parser, &event)) yaml_error(YAML_SCALAR_EVENT, &event);
Error: GCC_ANALYZER_WARNING (CWE-401): [#def109]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:152:56: warning[-Wanalyzer-malloc-leak]: leak of ‘table_file_name_check’
# 150| (event.type != YAML_SCALAR_EVENT))
# 151| yaml_error(YAML_SCALAR_EVENT, &event);
# 152|-> *table_file_name_check = strdup((const char *)event.data.scalar.value);
# 153| yaml_event_delete(&event);
# 154| } else {
Error: GCC_ANALYZER_WARNING (CWE-476): [#def110]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_table_value’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:210:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘table_name’
# 208| char *table_content = NULL;
# 209| yaml_event_t event;
# 210|-> table_name[0] = '\0';
# 211| if (!yaml_parser_parse(parser, &event) ||
# 212| !(event.type == YAML_SEQUENCE_START_EVENT ||
Error: CLANG_WARNING: [#def111]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:265:13: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'table_file_name')
# 263| do {
# 264| table_file_name++;
# 265|-> } while (*table_file_name);
# 266| while (table_file_name >= table_name && *table_file_name != '/' &&
# 267| *table_file_name != '\\')
Error: COMPILER_WARNING (CWE-704): [#def112]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_table_value’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:274:30: warning[-Wdiscarded-qualifiers]: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/stdlib.h:36: included_from: Included from here.
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:25: included_from: Included from here.
/usr/include/stdlib.h:687:25: note: expected ‘void *’ but argument is of type ‘const char *’
# 272| "'%s'",
# 273| table_file_name_check, table_file_name + 1);
# 274|-> free(table_file_name_check);
# 275| }
# 276| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def113]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:278:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘table’
# 276| }
# 277| table = malloc(sizeof(table_value));
# 278|-> table->name = table_name;
# 279| table->content = table_content;
# 280| table->location = start_line + 1;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def114]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_inPos’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:516:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pos’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_inPos’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_inPos’
# 514| "Too many input positions for translation of length %d.", translen);
# 515|
# 516|-> pos[i++] = parse_number((const char *)event.data.scalar.value, "input position",
# 517| event.start_mark.line + 1);
# 518| yaml_event_delete(&event);
Error: GCC_ANALYZER_WARNING (CWE-476): [#def115]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_outPos’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:548:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pos’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_outPos’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_outPos’
# 546| "Too many output positions for input string of length %d.", translen);
# 547|
# 548|-> pos[i++] = parse_number((const char *)event.data.scalar.value, "output position",
# 549| event.start_mark.line + 1);
# 550| yaml_event_delete(&event);
Error: GCC_ANALYZER_WARNING (CWE-688): [#def116]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_options’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:698:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘option_name’ where non-null expected
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_options’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘read_options’
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/string.h:41: included_from: Included from here.
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:27: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
# 696| strndup((const char *)event.data.scalar.value, event.data.scalar.length);
# 697|
# 698|-> if (!strcmp(option_name, "xfail")) {
# 699| yaml_event_delete(&event);
# 700| *xfail = read_xfail(parser);
Error: GCC_ANALYZER_WARNING (CWE-775): [#def117]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c: scope_hint: In function ‘main’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:1028:26: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(argv[1], "rb")’
# 1026| }
# 1027|
# 1028|-> char *dir_name = strdup(file_name);
# 1029| int i = strlen(dir_name);
# 1030| while (i > 0) {
Error: GCC_ANALYZER_WARNING (CWE-401): [#def118]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:1028:26: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(argv[1], "rb")’
# 1026| }
# 1027|
# 1028|-> char *dir_name = strdup(file_name);
# 1029| int i = strlen(dir_name);
# 1030| while (i > 0) {
Error: GCC_ANALYZER_WARNING (CWE-688): [#def119]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_checkyaml.c:1029:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘dir_name’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 1027|
# 1028| char *dir_name = strdup(file_name);
# 1029|-> int i = strlen(dir_name);
# 1030| while (i > 0) {
# 1031| if (dir_name[i - 1] == '/' || dir_name[i - 1] == '\\') {
Error: CPPCHECK_WARNING: [#def120]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: COMPILER_WARNING (CWE-681): [#def121]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c: scope_hint: In function ‘print_chars’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c:104:16: warning[-Wpointer-sign]: pointer targets in returning ‘uint8_t *’ {aka ‘unsigned char *’} from a function with return type ‘char *’ differ in signedness
# 104 | return result_buf;
# | ^~~~~~~~~~
# 102| #endif
# 103| result_buf[result_len] = 0;
# 104|-> return result_buf;
# 105| }
# 106|
Error: COMPILER_WARNING: [#def122]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c: scope_hint: In function ‘printRule’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c:111:47: warning[-Wformat=]: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘TranslationTableCharacterAttributes’ {aka ‘long long unsigned int’}
# 111 | if (thisRule->before) printf("before=%x, ", thisRule->before);
# | ~^ ~~~~~~~~~~~~~~~~
# | | |
# | unsigned int TranslationTableCharacterAttributes {aka long long unsigned int}
# | %llx
# 109| printf("Rule: ");
# 110| printf("opcode=%s, ", _lou_findOpcodeName(thisRule->opcode));
# 111|-> if (thisRule->before) printf("before=%x, ", thisRule->before);
# 112| if (thisRule->after) printf("after=%x, ", thisRule->after);
# 113| switch (thisRule->opcode) {
Error: COMPILER_WARNING: [#def123]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c:112:45: warning[-Wformat=]: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘TranslationTableCharacterAttributes’ {aka ‘long long unsigned int’}
# 112 | if (thisRule->after) printf("after=%x, ", thisRule->after);
# | ~^ ~~~~~~~~~~~~~~~
# | | |
# | unsigned int TranslationTableCharacterAttributes {aka long long unsigned int}
# | %llx
# 110| printf("opcode=%s, ", _lou_findOpcodeName(thisRule->opcode));
# 111| if (thisRule->before) printf("before=%x, ", thisRule->before);
# 112|-> if (thisRule->after) printf("after=%x, ", thisRule->after);
# 113| switch (thisRule->opcode) {
# 114| case CTO_Context:
Error: COMPILER_WARNING: [#def124]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c: scope_hint: In function ‘show_brailleIndicators’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_debug.c:324:57: warning[-Wformat=]: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘EmphasisClass’
# 324 | snprintf(name, BUFSIZE, "lenemphphrase %s", table->emphClasses[i]);
# | ~^ ~~~~~~~~~~~~~~~~~~~~~
# | | |
# | char * EmphasisClass
# 322| print_brailleIndicator(table->emphRules[i][offset], name);
# 323| }
# 324|-> snprintf(name, BUFSIZE, "lenemphphrase %s", table->emphClasses[i]);
# 325| print_phraseLength(table->emphRules[i][lenPhraseOffset], name);
# 326| }
Error: CPPCHECK_WARNING: [#def125]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_trace.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: COMPILER_WARNING (CWE-681): [#def126]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_trace.c: scope_hint: In function ‘print_chars’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_trace.c:97:16: warning[-Wpointer-sign]: pointer targets in returning ‘uint8_t *’ {aka ‘unsigned char *’} from a function with return type ‘char *’ differ in signedness
# 97 | return result_buf;
# | ^~~~~~~~~~
# 95| #endif
# 96| result_buf[result_len] = 0;
# 97|-> return result_buf;
# 98| }
# 99|
Error: CLANG_WARNING: [#def127]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_trace.c:288:39: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'const TranslationTableRule *', which is incompatible with sizeof operand type 'TranslationTableRule'
# 286| const TranslationTableHeader *translationTable;
# 287| const DisplayTableHeader *displayTable;
# 288|-> const TranslationTableRule **rules = malloc(512 * sizeof(TranslationTableRule));
# 289| int ruleslen;
# 290| int i, j;
Error: CPPCHECK_WARNING: [#def128]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING (CWE-456): [#def129]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c:227: error[uninitdata]: Memory is allocated but not initialized: tableOption
# 225| for (int i = optind; i < argc; i++) {
# 226| if (i > optind) strcat(tableOption, " ");
# 227|-> strcat(tableOption, argv[i]);
# 228| }
# 229| }
Error: GCC_ANALYZER_WARNING (CWE-688): [#def130]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c:227:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘tableOption’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strcat’ must be non-null
# 225| for (int i = optind; i < argc; i++) {
# 226| if (i > optind) strcat(tableOption, " ");
# 227|-> strcat(tableOption, argv[i]);
# 228| }
# 229| }
Error: GCC_ANALYZER_WARNING (CWE-457): [#def131]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c: scope_hint: In function ‘main’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c:227:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*tableOption’
liblouis-3.28.0-build/liblouis-3.28.0/tools/gnulib/string.h:41: included_from: Included from here.
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c:26: included_from: Included from here.
/usr/include/string.h:149:14: note: argument 1 of ‘strcat’ must be a pointer to a null-terminated string
# 225| for (int i = optind; i < argc; i++) {
# 226| if (i > optind) strcat(tableOption, " ");
# 227|-> strcat(tableOption, argv[i]);
# 228| }
# 229| }
Error: COMPILER_WARNING (CWE-1164): [#def132]
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c: scope_hint: In function ‘main’
liblouis-3.28.0-build/liblouis-3.28.0/tools/lou_translate.c:275:1: warning[-Wunused-label]: label ‘success’ defined but not used
# 275 | success:
# | ^~~~~~~
# 273| translate_input(!backward_flag, table, mode, stdin);
# 274|
# 275|-> success:
# 276| exitValue = EXIT_SUCCESS;
# 277| failure:
Scan Properties
analyzer-version-clang | 18.1.7 |
analyzer-version-cppcheck | 2.14.2 |
analyzer-version-gcc | 14.1.1 |
analyzer-version-gcc-analyzer | 14.1.1 |
analyzer-version-shellcheck | 0.10.0 |
enabled-plugins | clang, cppcheck, gcc, shellcheck |
exit-code | 0 |
host | ip-172-16-1-72.us-west-2.compute.internal |
mock-config | fedora-41-x86_64 |
project-name | liblouis-3.28.0-6.fc41 |
store-results-to | /tmp/tmpcystoehg/liblouis-3.28.0-6.fc41.tar.xz |
time-created | 2024-07-03 15:54:28 |
time-finished | 2024-07-03 15:58:30 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpcystoehg/liblouis-3.28.0-6.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpcystoehg/liblouis-3.28.0-6.fc41.src.rpm' |
tool-version | csmock-3.5.3-1.el9 |