Task #2003 - wavpack-5.6.0-6.fc40/scan-results.err
back to task #2003download
Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/aiff.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/aiff_write.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c:188:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'channel_identities' # 186| if (!DoReadFile (infile, &caf_chunk_header, sizeof (CAFChunkHeader), &bcount) || # 187| bcount != sizeof (CAFChunkHeader)) { # 188|-> error_line ("%s is not a valid .CAF file!", infilename); # 189| return WAVPACK_SOFT_ERROR; # 190| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c:188:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'channel_reorder' # 186| if (!DoReadFile (infile, &caf_chunk_header, sizeof (CAFChunkHeader), &bcount) || # 187| bcount != sizeof (CAFChunkHeader)) { # 188|-> error_line ("%s is not a valid .CAF file!", infilename); # 189| return WAVPACK_SOFT_ERROR; # 190| } Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c: scope_hint: In function ‘ParseCaffHeaderConfig’ wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c:343:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘channel_reorder’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 341| # 342| channel_reorder = malloc (num_descriptions); # 343|-> memset (channel_reorder, -1, num_descriptions); # 344| channel_identities = malloc (num_descriptions+1); # 345| Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c:372:67: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘channel_identities’ # 370| # 371| if (clabel == 0 || clabel == 0xffffffff || clabel == 100) # 372|-> channel_identities [idents++] = 0xff; # 373| else if ((clabel >= 33 && clabel <= 44) || (clabel >= 200 && clabel <= 207) || (clabel >= 301 && clabel <= 305)) # 374| channel_identities [idents++] = clabel >= 301 ? clabel - 80 : clabel; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c:374:67: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘channel_identities’ # 372| channel_identities [idents++] = 0xff; # 373| else if ((clabel >= 33 && clabel <= 44) || (clabel >= 200 && clabel <= 207) || (clabel >= 301 && clabel <= 305)) # 374|-> channel_identities [idents++] = clabel >= 301 ? clabel - 80 : clabel; # 375| else { # 376| error_line ("warning: unknown channel descriptions label: %d", clabel); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/caff.c:377:67: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘channel_identities’ # 375| else { # 376| error_line ("warning: unknown channel descriptions label: %d", clabel); # 377|-> channel_identities [idents++] = 0xff; # 378| } # 379| Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/caff_write.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/dsdiff.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/dsdiff_write.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/dsf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/dsf_write.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c: scope_hint: In function ‘ImportID3v2_syncsafe’ wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:165:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘frame_body’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 163| frame_body = malloc (frame_size + 4); # 164| # 165|-> memcpy (frame_body, tag_data, frame_size); # 166| tag_size -= frame_size; # 167| tag_data += frame_size; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:180:53: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(frame_size * 3))’ # 178| # 179| for (i = 0; fp < fe; ++i) # 180|-> if (!(utf8_strings [si] [i] = *fp++)) # 181| break; # 182| Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:184:47: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(frame_size * 3))’ # 182| # 183| if (fp == fe) # 184|-> utf8_strings [si] [i] = 0; # 185| # 186| Latin1ToUTF8 (utf8_strings [si++], frame_size * 3); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:198:47: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘wide_string’ # 196| # 197| for (i = 0; fp <= fe - 2; ++i, fp += 2) # 198|-> if (!(wide_string [i] = fp [0] | (fp [1] << 8))) { # 199| fp += 2; # 200| break; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:203:37: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘wide_string’ # 201| } # 202| # 203|-> wide_string [i] = 0; # 204| WideCharToUTF8 (wide_string, utf8_strings [si++], frame_size * 2); # 205| } Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:323:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘binary_tag_image’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 321| char *binary_tag_image = malloc (binary_tag_size); # 322| # 323|-> strcpy (binary_tag_image, item); # 324| strcat (binary_tag_image, extension); # 325| memcpy (binary_tag_image + binary_tag_size - frame_bytes, frame_ptr, frame_bytes); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c: scope_hint: In function ‘WideCharToUTF8’ wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:401:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pUTF8’ # 399| while (*pWide) { # 400| if (*pWide < 0x80 && outndx + 1 < len) # 401|-> pUTF8 [outndx++] = (unsigned char) *pWide++; # 402| else if (*pWide < 0x800 && outndx + 2 < len) { # 403| pUTF8 [outndx++] = (unsigned char) (0xc0 | ((*pWide >> 6) & 0x1f)); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:403:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pUTF8’ # 401| pUTF8 [outndx++] = (unsigned char) *pWide++; # 402| else if (*pWide < 0x800 && outndx + 2 < len) { # 403|-> pUTF8 [outndx++] = (unsigned char) (0xc0 | ((*pWide >> 6) & 0x1f)); # 404| pUTF8 [outndx++] = (unsigned char) (0x80 | (*pWide++ & 0x3f)); # 405| } Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:407:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pUTF8’ # 405| } # 406| else if (outndx + 3 < len) { # 407|-> pUTF8 [outndx++] = (unsigned char) (0xe0 | ((*pWide >> 12) & 0xf)); # 408| pUTF8 [outndx++] = (unsigned char) (0x80 | ((*pWide >> 6) & 0x3f)); # 409| pUTF8 [outndx++] = (unsigned char) (0x80 | (*pWide++ & 0x3f)); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:415:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pUTF8’ # 413| } # 414| # 415|-> pUTF8 [outndx] = 0; # 416| return (int)(pWide - Wide); # 417| } Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c: scope_hint: In function ‘Latin1ToUTF8’ wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:453:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘temp’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 451| iconv_t converter; # 452| # 453|-> memset(temp, 0, len); # 454| # 455| insize = strlen (string); Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:455:14: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘string’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 453| memset(temp, 0, len); # 454| # 455|-> insize = strlen (string); # 456| converter = iconv_open ("UTF-8", "ISO-8859-1"); # 457| Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:455:14: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*(char *)string’ wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:17: included_from: Included from here. /usr/include/string.h:407:15: note: argument 1 of ‘strlen’ must be a pointer to a null-terminated string # 453| memset(temp, 0, len); # 454| # 455|-> insize = strlen (string); # 456| converter = iconv_open ("UTF-8", "ISO-8859-1"); # 457| Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/import_id3.c:458:8: warning[-Wanalyzer-malloc-leak]: leak of ‘iconv_open("UTF-8", "ISO-8859-1")’ # 456| converter = iconv_open ("UTF-8", "ISO-8859-1"); # 457| # 458|-> if (converter != (iconv_t) -1) { # 459| err = iconv (converter, &inp, &insize, &outp, &outsize); # 460| iconv_close (converter); Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/riff.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/riff_write.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wave64.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c: scope_hint: In function ‘main’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:350:5: warning[-Wstringop-truncation]: ‘strncpy’ specified bound 4096 equals destination size # 350 | strncpy (selfname, *argv, sizeof (selfname)); # | ^ # 348| if (!GetModuleFileName (NULL, selfname, sizeof (selfname))) # 349| #endif # 350|-> strncpy (selfname, *argv, sizeof (selfname)); # 351| # 352| if (filespec_name (selfname)) { Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:369: error[memleakOnRealloc]: Common realloc mistake: 'argv_fn' nulled but not freed upon failure # 367| char *option = malloc (option_len + 1); # 368| # 369|-> argv_fn = realloc (argv_fn, sizeof (char *) * ++argc_fn); # 370| memcpy (option, open_brace + 1, option_len); # 371| argv_fn [argc_fn - 1] = option; Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:414:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'matches' # 412| # 413| if (!strcmp (long_option, "help")) { // --help # 414|-> printf ("%s", help); # 415| return 0; # 416| } Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:838: error[memleakOnRealloc]: Common realloc mistake: 'tag_items' nulled but not freed upon failure # 836| int i = num_tag_items; # 837| # 838|-> tag_items = realloc (tag_items, ++num_tag_items * sizeof (*tag_items)); # 839| tag_items [i].item = malloc (cp - argcp + 1); # 840| memcpy (tag_items [i].item, argcp, cp - argcp); Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:893: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 891| } # 892| else { # 893|-> matches = realloc (matches, (num_files + 1) * sizeof (*matches)); # 894| matches [num_files] = malloc (strlen (argcp) + 10); # 895| strcpy (matches [num_files], argcp); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:1009:54: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 1007| // user may have specified on the command line # 1008| # 1009|-> if (!file && num_files && filespec_name (matches [0]) && *matches [0] != '-') { # 1010| char *temp = malloc (strlen (matches [0]) + PATH_MAX); # 1011| Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:1119:28: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 1117| # 1118| for (file_index = 0; file_index < num_files; ++file_index) { # 1119|-> char *infilename = matches [file_index]; # 1120| # 1121| // If the single infile specification begins with a '@', then it Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:1146: error[memleakOnRealloc]: Common realloc mistake: 'listbuff' nulled but not freed upon failure # 1144| int bytes_read; # 1145| # 1146|-> listbuff = realloc (listbuff, listbytes + 1024); # 1147| memset (listbuff + listbytes, 0, 1024); # 1148| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:1174: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 1172| # 1173| fname [ci++] = '\0'; # 1174|-> matches = realloc (matches, ++num_files * sizeof (*matches)); # 1175| # 1176| for (di = num_files - 1; di > file_index + 1; di--) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:1247:9: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 1245| # 1246| memset (listbuff, 0, sizeof (listbuff)); # 1247|-> c = (int) fread (listbuff, 1, sizeof (listbuff) - 1, list); // assign c only to suppress warning # 1248| # 1249| #if defined (_WIN32) Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:2042: error[memleakOnRealloc]: Common realloc mistake: 'buffer' nulled but not freed upon failure # 2040| while (DoReadFile (infile, buffer + wrapper_size, buffer_size - wrapper_size, &bcount) && bcount) # 2041| if ((wrapper_size += bcount) == buffer_size) # 2042|-> buffer = realloc (buffer, buffer_size += 65536); # 2043| # 2044| // if we got something and are storing wrapper, write it to the outfile file Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:2943:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'out2filename_temp' # 2941| } # 2942| else if ((wv_file.file = fopen (use_tempfiles ? outfilename_temp : outfilename, "w+b")) == NULL) { # 2943|-> error_line ("can't create file %s!", use_tempfiles ? outfilename_temp : outfilename); # 2944| WavpackCloseFile (infile); # 2945| WavpackCloseFile (outfile); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:3477:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'format_buffer' # 3475| # 3476| if (!WavpackPackSamples (outfile, sample_buffer, sample_count)) { # 3477|-> error_line ("%s", WavpackGetErrorMessage (outfile)); # 3478| free (sample_buffer); # 3479| return WAVPACK_HARD_ERROR; Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:3524:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'dptr' # 3522| fprintf (stderr, "^C\n"); # 3523| #else # 3524|-> fprintf (stderr, "\n"); # 3525| #endif # 3526| fflush (stderr); Error: CPPCHECK_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:3585: error[uninitvar]: Uninitialized variable: temp # 3583| } # 3584| # 3585|-> memcpy (start, temp, num_chans * bytes_per_sample); # 3586| } # 3587| Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:3764:17: warning[core.CallAndMessage]: 3rd function call argument is an uninitialized value # 3762| # 3763| for (i = 0; i < 16; ++i) { # 3764|-> sprintf (md5_string1 + (i * 2), "%02x", md5_digest_source [i]); # 3765| sprintf (md5_string2 + (i * 2), "%02x", md5_digest_result [i]); # 3766| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wavpack.c:4332:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'outp' # 4330| if (len > 3 && (unsigned char) inp [0] == 0xEF && (unsigned char) inp [1] == 0xBB && # 4331| (unsigned char) inp [2] == 0xBF) { # 4332|-> memmove (inp, inp + 3, len - 3); # 4333| inp [len - 3] = 0; # 4334| return; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:181:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'matches' # 179| # 180| case 'V': case 'v': # 181|-> printf ("wvgain %s\n", PACKAGE_VERSION); # 182| printf ("libwavpack %s\n", WavpackGetLibraryVersionString ()); # 183| return 0; Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:232: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 230| } # 231| else { # 232|-> matches = realloc (matches, (num_files + 1) * sizeof (*matches)); # 233| matches [num_files] = malloc (strlen (*argv) + 10); # 234| strcpy (matches [num_files], *argv); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c: scope_hint: In function ‘main’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:233:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘matches’ # 231| else { # 232| matches = realloc (matches, (num_files + 1) * sizeof (*matches)); # 233|-> matches [num_files] = malloc (strlen (*argv) + 10); # 234| strcpy (matches [num_files], *argv); # 235| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:234:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*argv) + 10)’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 232| matches = realloc (matches, (num_files + 1) * sizeof (*matches)); # 233| matches [num_files] = malloc (strlen (*argv) + 10); # 234|-> strcpy (matches [num_files], *argv); # 235| # 236| if (*(matches [num_files]) != '-' && *(matches [num_files]) != '@' && Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:275:28: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 273| # 274| for (file_index = 0; file_index < num_files; ++file_index) { # 275|-> char *infilename = matches [file_index]; # 276| # 277| // If the single infile specification begins with a '@', then it Error: GCC_ANALYZER_WARNING (CWE-126): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:288:40: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:288:40: note: read of 8 bytes from after the end of the region # └──────────────────────────────────┘ # ^ # 286| # 287| for (di = file_index; di < num_files - 1; di++) # 288|-> matches [di] = matches [di + 1]; # 289| # 290| file_index--; Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:302: error[memleakOnRealloc]: Common realloc mistake: 'listbuff' nulled but not freed upon failure # 300| int bytes_read; # 301| # 302|-> listbuff = realloc (listbuff, listbytes + 1024); # 303| memset (listbuff + listbytes, 0, 1024); # 304| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); Error: GCC_ANALYZER_WARNING (CWE-415): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:302:28: warning[-Wanalyzer-double-free]: double-‘free’ of ‘listbuff’ # 300| int bytes_read; # 301| # 302|-> listbuff = realloc (listbuff, listbytes + 1024); # 303| memset (listbuff + listbytes, 0, 1024); # 304| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:303:17: warning[-Wanalyzer-null-argument]: use of NULL ‘listbuff’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 301| # 302| listbuff = realloc (listbuff, listbytes + 1024); # 303|-> memset (listbuff + listbytes, 0, 1024); # 304| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); # 305| Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:306:20: warning[-Wanalyzer-malloc-leak]: leak of ‘listbuff’ # 304| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); # 305| # 306|-> if (bytes_read < 1024) # 307| break; # 308| } Error: GCC_ANALYZER_WARNING (CWE-416): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:316:25: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘cp’ # 314| cp = listbuff; # 315| # 316|-> while ((c = *cp++)) { # 317| # 318| while (c == '\n' || c == '\r') Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:326:38: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘fname’ # 324| # 325| do # 326|-> fname [ci++] = c; # 327| while ((c = *cp++) != '\n' && c != '\r' && c && ci < PATH_MAX); # 328| Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:330: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 328| # 329| fname [ci++] = '\0'; # 330|-> matches = realloc (matches, ++num_files * sizeof (*matches)); # 331| # 332| for (di = num_files - 1; di > file_index + 1; di--) Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:335:44: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘matches’ # 333| matches [di] = matches [di - 1]; # 334| # 335|-> matches [++file_index] = fname; # 336| } # 337| Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:494:49: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 492| # 493| if (num_files > 1 && !quiet_mode) { # 494|-> fprintf (stderr, "\n%s:\n", matches [file_index]); # 495| fflush (stderr); # 496| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:499:46: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 497| # 498| if (show_mode) # 499|-> result = show_file_info (matches [file_index], stdout); # 500| else # 501| result = update_file (matches [file_index], track_gains [file_index], track_peaks [file_index], album_gain, album_peak); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:501:43: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 499| result = show_file_info (matches [file_index], stdout); # 500| else # 501|-> result = update_file (matches [file_index], track_gains [file_index], track_peaks [file_index], album_gain, album_peak); # 502| # 503| free (matches [file_index]); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvgain.c:1378:41: warning[core.DivideZero]: Division by zero # 1376| } # 1377| # 1378|-> return (int)(out_samples - samples) / num_channels; # 1379| } # 1380| Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:292:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'matches' # 290| # 291| case 'V': case 'v': # 292|-> printf ("wvtag %s\n", PACKAGE_VERSION); # 293| printf ("libwavpack %s\n", WavpackGetLibraryVersionString ()); # 294| return 0; Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:337: error[memleakOnRealloc]: Common realloc mistake: 'tag_items' nulled but not freed upon failure # 335| int i = num_tag_items; # 336| # 337|-> tag_items = realloc (tag_items, ++num_tag_items * sizeof (*tag_items)); # 338| tag_items [i].item = malloc (cp - *argv + 1); # 339| memcpy (tag_items [i].item, *argv, cp - *argv); Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:362: error[memleakOnRealloc]: Common realloc mistake: 'tag_items' nulled but not freed upon failure # 360| } # 361| # 362|-> tag_items = realloc (tag_items, ++num_tag_items * sizeof (*tag_items)); # 363| tag_items [i].item = strdup (*argv); # 364| tag_items [i].binary = 0; Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:370: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 368| } # 369| else { # 370|-> matches = realloc (matches, (num_files + 1) * sizeof (*matches)); # 371| matches [num_files] = malloc (strlen (*argv) + 10); # 372| strcpy (matches [num_files], *argv); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:513:14: warning[deadcode.DeadStores]: Although the value stored to 'total_tag_size' is used in the enclosing expression, the value is never actually read from 'total_tag_size' # 511| } # 512| # 513|-> if ((total_tag_size += tag_items [i].vsize) > 1048576 * (allow_huge_tags ? 16 : 1)) { # 514| error_line ("total APEv2 tag size exceeds %d MB !", allow_huge_tags ? 16 : 1); # 515| ++error_count; Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:556: error[memleakOnRealloc]: Common realloc mistake: 'listbuff' nulled but not freed upon failure # 554| int bytes_read; # 555| # 556|-> listbuff = realloc (listbuff, listbytes + 1024); # 557| memset (listbuff + listbytes, 0, 1024); # 558| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:584: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 582| # 583| fname [ci++] = '\0'; # 584|-> matches = realloc (matches, ++num_files * sizeof (*matches)); # 585| # 586| for (di = num_files - 1; di > file_index + 1; di--) Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:907: error[memleakOnRealloc]: Common realloc mistake: 'tag_extractions' nulled but not freed upon failure # 905| static void add_tag_extraction_to_list (char *spec) # 906| { # 907|-> tag_extractions = realloc (tag_extractions, (num_tag_extractions + 1) * sizeof (*tag_extractions)); # 908| tag_extractions [num_tag_extractions] = malloc (strlen (spec) + 10); # 909| strcpy (tag_extractions [num_tag_extractions], spec); Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: scope_hint: In function ‘add_tag_extraction_to_list’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:909:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(spec) + 10)’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 907| tag_extractions = realloc (tag_extractions, (num_tag_extractions + 1) * sizeof (*tag_extractions)); # 908| tag_extractions [num_tag_extractions] = malloc (strlen (spec) + 10); # 909|-> strcpy (tag_extractions [num_tag_extractions], spec); # 910| num_tag_extractions++; # 911| } Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: scope_hint: In function ‘do_tag_extractions’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:920:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘extraction_spec’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 918| for (i = 0; result == WAVPACK_NO_ERROR && i < num_tag_extractions; ++i) { # 919| char *extraction_spec = strdup (tag_extractions [i]); # 920|-> char *output_spec = strchr (extraction_spec, '='); # 921| char tag_filename [256]; # 922| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:923:61: warning[-Wanalyzer-null-argument]: use of NULL ‘output_spec’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 921| char tag_filename [256]; # 922| # 923|-> if (output_spec && output_spec > extraction_spec && strlen (output_spec) > 1) # 924| *output_spec++ = 0; # 925| Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:927:65: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘tag_filename[0]’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:30: included_from: Included from here. /usr/include/string.h:407:15: note: argument 1 of ‘strlen’ must be a pointer to a null-terminated string # 925| # 926| if (dump_tag_item_to_file (wpc, extraction_spec, NULL, tag_filename)) { # 927|-> int max_length = (int) strlen (outfilename) + (int) strlen (tag_filename) + 10; # 928| char *full_filename; # 929| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:934:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘full_filename’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 932| # 933| full_filename = malloc (max_length * 2 + 1); # 934|-> strcpy (full_filename, outfilename); # 935| # 936| if (output_spec) { Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: scope_hint: In function ‘dump_UTF8_string’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1316:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’ # 1314| while (*string) { # 1315| if (*string != '\r') # 1316|-> *p++ = *string; # 1317| # 1318| if (*string++ == '\n') Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1322:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’ # 1320| } # 1321| # 1322|-> *p = 0; # 1323| # 1324| #ifdef _WIN32 Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: scope_hint: In function ‘UTF8ToAnsi’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1374:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘temp’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 1372| iconv_t converter; # 1373| # 1374|-> memset(temp, 0, len); # 1375| old_locale = setlocale (LC_CTYPE, ""); # 1376| converter = iconv_open ("", "UTF-8"); Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1378:8: warning[-Wanalyzer-malloc-leak]: leak of ‘iconv_open("", "UTF-8")’ # 1376| converter = iconv_open ("", "UTF-8"); # 1377| # 1378|-> if (converter != (iconv_t) -1) { # 1379| err = iconv (converter, &inp, &insize, &outp, &outsize); # 1380| iconv_close (converter); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1525:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'outp' # 1523| if (len > 3 && (unsigned char) inp [0] == 0xEF && (unsigned char) inp [1] == 0xBB && # 1524| (unsigned char) inp [2] == 0xBF) { # 1525|-> memmove (inp, inp + 3, len - 3); # 1526| inp [len - 3] = 0; # 1527| return; Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1527:13: warning[-Wanalyzer-malloc-leak]: leak of ‘converter’ # 1525| memmove (inp, inp + 3, len - 3); # 1526| inp [len - 3] = 0; # 1527|-> return; # 1528| } # 1529| Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: scope_hint: In function ‘TextToUTF8’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1527:13: warning[-Wanalyzer-malloc-leak]: leak of ‘temp’ # 1525| memmove (inp, inp + 3, len - 3); # 1526| inp [len - 3] = 0; # 1527|-> return; # 1528| } # 1529| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1530:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘temp’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 1528| } # 1529| # 1530|-> memset(temp, 0, len); # 1531| old_locale = setlocale (LC_CTYPE, ""); # 1532| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c: scope_hint: In function ‘wild_fopen’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvtag.c:1642:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘matchname’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 1640| else { # 1641| matchname = malloc (strlen (globbuf.gl_pathv [i]) + 10); # 1642|-> strcpy (matchname, globbuf.gl_pathv [i]); # 1643| } # 1644| } Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘main’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:288:5: warning[-Wstringop-truncation]: ‘strncpy’ specified bound 4096 equals destination size # 288 | strncpy (selfname, *argv, sizeof (selfname)); # | ^ # 286| if (!GetModuleFileName (NULL, selfname, sizeof (selfname))) # 287| #endif # 288|-> strncpy (selfname, *argv, sizeof (selfname)); # 289| # 290| if (filespec_name (selfname)) { Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:307: error[memleakOnRealloc]: Common realloc mistake: 'argv_fn' nulled but not freed upon failure # 305| char *option = malloc (option_len + 1); # 306| # 307|-> argv_fn = realloc (argv_fn, sizeof (char *) * ++argc_fn); # 308| memcpy (option, open_brace + 1, option_len); # 309| argv_fn [argc_fn - 1] = option; Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:350:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'argv_fn' # 348| # 349| if (!strcmp (long_option, "help")) { // --help # 350|-> printf ("%s", help); # 351| return 0; # 352| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:350:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'matches' # 348| # 349| if (!strcmp (long_option, "help")) { // --help # 350|-> printf ("%s", help); # 351| return 0; # 352| } Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:600: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 598| } # 599| else { # 600|-> matches = realloc (matches, (num_files + 1) * sizeof (*matches)); # 601| matches [num_files] = malloc (strlen (argcp) + 10); # 602| strcpy (matches [num_files], argcp); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:704:28: warning[core.NullDereference]: Array access (from variable 'matches') results in a null pointer dereference # 702| # 703| for (file_index = 0; file_index < num_files; ++file_index) { # 704|-> char *infilename = matches [file_index]; # 705| # 706| // If the single infile specification begins with a '@', then it Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:723:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'matches' # 721| # 722| if (list == NULL) { # 723|-> error_line ("file %s not found!", infilename+1); # 724| free (infilename); # 725| return 1; Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:731: error[memleakOnRealloc]: Common realloc mistake: 'listbuff' nulled but not freed upon failure # 729| int bytes_read; # 730| # 731|-> listbuff = realloc (listbuff, listbytes + 1024); # 732| memset (listbuff + listbytes, 0, 1024); # 733| listbytes += bytes_read = (int) fread (listbuff + listbytes, 1, 1024, list); Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:759: error[memleakOnRealloc]: Common realloc mistake: 'matches' nulled but not freed upon failure # 757| # 758| fname [ci++] = '\0'; # 759|-> matches = realloc (matches, ++num_files * sizeof (*matches)); # 760| # 761| for (di = num_files - 1; di > file_index + 1; di--) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:832:9: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 830| # 831| memset (listbuff, 0, sizeof (listbuff)); # 832|-> c = (int) fread (listbuff, 1, sizeof (listbuff) - 1, list); // assign c only to suppress warning # 833| # 834| #if defined (_WIN32) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:1889:13: warning[core.CallAndMessage]: 3rd function call argument is an uninitialized value # 1887| # 1888| for (i = 0; i < 16; ++i) # 1889|-> sprintf (md5_string2 + (i * 2), "%02x", md5_unpacked [i]); # 1890| # 1891| error_line ("unpacked md5: %s", md5_string2); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘unpack_audio’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2111:39: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_channel_order’ # 2109| # 2110| for (i = 0; i < num_channels; ++i) # 2111|-> new_channel_order [i] = i; # 2112| # 2113| WavpackGetChannelLayout (wpc, new_channel_order); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘unpack_dsd_audio’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2258:39: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_channel_order’ # 2256| # 2257| for (i = 0; i < num_channels; ++i) # 2258|-> new_channel_order [i] = i; # 2259| # 2260| WavpackGetChannelLayout (wpc, new_channel_order); Error: CPPCHECK_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2365: error[memleakOnRealloc]: Common realloc mistake: 'tag_extractions' nulled but not freed upon failure # 2363| static void add_tag_extraction_to_list (char *spec) # 2364| { # 2365|-> tag_extractions = realloc (tag_extractions, (num_tag_extractions + 1) * sizeof (*tag_extractions)); # 2366| tag_extractions [num_tag_extractions] = malloc (strlen (spec) + 10); # 2367| strcpy (tag_extractions [num_tag_extractions], spec); Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘add_tag_extraction_to_list’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2367:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(spec) + 10)’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 2365| tag_extractions = realloc (tag_extractions, (num_tag_extractions + 1) * sizeof (*tag_extractions)); # 2366| tag_extractions [num_tag_extractions] = malloc (strlen (spec) + 10); # 2367|-> strcpy (tag_extractions [num_tag_extractions], spec); # 2368| num_tag_extractions++; # 2369| } Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘do_tag_extractions’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2378:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘extraction_spec’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 2376| for (i = 0; result == WAVPACK_NO_ERROR && i < num_tag_extractions; ++i) { # 2377| char *extraction_spec = strdup (tag_extractions [i]); # 2378|-> char *output_spec = strchr (extraction_spec, '='); # 2379| char tag_filename [256]; # 2380| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2381:61: warning[-Wanalyzer-null-argument]: use of NULL ‘output_spec’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 2379| char tag_filename [256]; # 2380| # 2381|-> if (output_spec && output_spec > extraction_spec && strlen (output_spec) > 1) # 2382| *output_spec++ = 0; # 2383| Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2385:65: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘tag_filename[0]’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:41: included_from: Included from here. /usr/include/string.h:407:15: note: argument 1 of ‘strlen’ must be a pointer to a null-terminated string # 2383| # 2384| if (dump_tag_item_to_file (wpc, extraction_spec, NULL, tag_filename)) { # 2385|-> int max_length = (int) strlen (outfilename) + (int) strlen (tag_filename) + 10; # 2386| char *full_filename; # 2387| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2392:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘full_filename’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 2390| # 2391| full_filename = malloc (max_length * 2 + 1); # 2392|-> strcpy (full_filename, outfilename); # 2393| # 2394| if (output_spec) { Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘unreorder_channels’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2703:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘temp’ # 2701| # 2702| for (chan = 0; chan < num_chans; ++chan) # 2703|-> temp [chan] = data [order[chan]]; # 2704| # 2705| memcpy (data, temp, num_chans * sizeof (*data)); Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:2705:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘temp’ # 2703| temp [chan] = data [order[chan]]; # 2704| # 2705|-> memcpy (data, temp, num_chans * sizeof (*data)); # 2706| data += num_chans; # 2707| } Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘dump_UTF8_string’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:3202:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’ # 3200| while (*string) { # 3201| if (*string != '\r') # 3202|-> *p++ = *string; # 3203| # 3204| if (*string++ == '\n') Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:3208:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’ # 3206| } # 3207| # 3208|-> *p = 0; # 3209| # 3210| #ifdef _WIN32 Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c: scope_hint: In function ‘UTF8ToAnsi’ wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:3369:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘temp’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 3367| iconv_t converter; # 3368| # 3369|-> memset(temp, 0, len); # 3370| old_locale = setlocale (LC_CTYPE, ""); # 3371| converter = iconv_open ("", "UTF-8"); Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/cli/wvunpack.c:3373:8: warning[-Wanalyzer-malloc-leak]: leak of ‘iconv_open("", "UTF-8")’ # 3371| converter = iconv_open ("", "UTF-8"); # 3372| # 3373|-> if (converter != (iconv_t) -1) { # 3374| err = iconv (converter, &inp, &insize, &outp, &outsize); # 3375| iconv_close (converter); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/wavpack_local.h:14: included_from: Included from here. wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:22: included_from: Included from here. wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c: scope_hint: In function 'write_metadata_block' wavpack-5.6.0-build/wavpack-5.6.0/include/wavpack.h:100:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'block_buff' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' # 98| int64_t tmp = (value); \ # 99| if (tmp < 0) \ # 100|-> (hdr).total_samples = (uint32_t) -1; \ # 101| else { \ # 102| tmp += (tmp / 0xffffffffLL); \ Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/include/wavpack.h:103:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'block_buff' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1277:9: note: in expansion of macro 'SET_TOTAL_SAMPLES' # 101| else { \ # 102| tmp += (tmp / 0xffffffffLL); \ # 103|-> (hdr).total_samples = (uint32_t) tmp; \ # 104| (hdr).total_samples_u8 = \ # 105| (unsigned char) (tmp >> 32); \ Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/common_utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:97: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 95| # 96| left -= apply_weight (dpp->weight_A, sam_A); # 97|-> update_weight (dpp->weight_A, dpp->delta, sam_A, left); # 98| dpp->sum_A += dpp->weight_A; # 99| out_samples [0] = left; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c: scope_hint: In function 'decorr_mono_pass' wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:99:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'out_samples' # 97| update_weight (dpp->weight_A, dpp->delta, sam_A, left); # 98| dpp->sum_A += dpp->weight_A; # 99|-> out_samples [0] = left; # 100| in_samples += dir; # 101| out_samples += dir; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:114: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 112| # 113| left -= apply_weight (dpp->weight_A, sam_A); # 114|-> update_weight (dpp->weight_A, dpp->delta, sam_A, left); # 115| dpp->sum_A += dpp->weight_A; # 116| out_samples [0] = left; Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:437:5: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 435| # 436| memcpy (info.dps, wps->decorr_passes, sizeof (info.dps)); # 437|-> memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 4); # 438| # 439| for (i = 0; i < info.nterms && info.dps [i].term; ++i) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:442:22: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 440| decorr_mono_pass (info.sampleptrs [i], info.sampleptrs [i + 1], wps->wphdr.block_samples, info.dps + i, 1); # 441| # 442|-> info.best_bits = LOG2BUFFER (info.sampleptrs [info.nterms], wps->wphdr.block_samples, 0) * 1; # 443| info.best_bits += log2overhead (info.dps [0].term, i); # 444| memcpy (info.sampleptrs [info.nterms + 1], info.sampleptrs [i], wps->wphdr.block_samples * 4); Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c: scope_hint: In function 'execute_mono' wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:610:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc((long unsigned int)buf_size)' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 608| # 609| while (1) { # 610|-> memcpy (temp_buffer [0], noisy_buffer ? noisy_buffer : samples, buf_size); # 611| CLEARA (save_decorr_passes); # 612| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/extra1.c:645:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'best_buffer' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 643| # 644| if (size < best_size) { # 645|-> memcpy (best_buffer, temp_buffer [j&1], buf_size); # 646| memcpy (wps->decorr_passes, save_decorr_passes, sizeof (struct decorr_pass) * MAX_NTERMS); # 647| wps->num_terms = nterms; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:104: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 102| dpp->samples_A [0] = dpp->samples_A [1]; # 103| out_samples [0] = tmp = (dpp->samples_A [1] = in_samples [0]) - apply_weight (dpp->weight_A, sam); # 104|-> update_weight (dpp->weight_A, dpp->delta, sam, tmp); # 105| dpp->sum_A += dpp->weight_A; # 106| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:110: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 108| dpp->samples_B [0] = dpp->samples_B [1]; # 109| out_samples [1] = tmp = (dpp->samples_B [1] = in_samples [1]) - apply_weight (dpp->weight_B, sam); # 110|-> update_weight (dpp->weight_B, dpp->delta, sam, tmp); # 111| dpp->sum_B += dpp->weight_B; # 112| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:126: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 124| dpp->samples_A [1] = dpp->samples_A [0]; # 125| out_samples [0] = tmp = (dpp->samples_A [0] = in_samples [0]) - apply_weight (dpp->weight_A, sam); # 126|-> update_weight (dpp->weight_A, dpp->delta, sam, tmp); # 127| dpp->sum_A += dpp->weight_A; # 128| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:132: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 130| dpp->samples_B [1] = dpp->samples_B [0]; # 131| out_samples [1] = tmp = (dpp->samples_B [0] = in_samples [1]) - apply_weight (dpp->weight_B, sam); # 132|-> update_weight (dpp->weight_B, dpp->delta, sam, tmp); # 133| dpp->sum_B += dpp->weight_B; # 134| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:148: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 146| dpp->samples_A [1] = dpp->samples_A [0]; # 147| out_samples [0] = tmp = (dpp->samples_A [0] = in_samples [0]) - apply_weight (dpp->weight_A, sam); # 148|-> update_weight (dpp->weight_A, dpp->delta, sam, tmp); # 149| dpp->sum_A += dpp->weight_A; # 150| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:154: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 152| dpp->samples_B [1] = dpp->samples_B [0]; # 153| out_samples [1] = tmp = (dpp->samples_B [0] = in_samples [1]) - apply_weight (dpp->weight_B, sam); # 154|-> update_weight (dpp->weight_B, dpp->delta, sam, tmp); # 155| dpp->sum_B += dpp->weight_B; # 156| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:171: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 169| sam = dpp->samples_A [m]; # 170| out_samples [0] = tmp = (dpp->samples_A [k] = in_samples [0]) - apply_weight (dpp->weight_A, sam); # 171|-> update_weight (dpp->weight_A, dpp->delta, sam, tmp); # 172| dpp->sum_A += dpp->weight_A; # 173| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:176: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 174| sam = dpp->samples_B [m]; # 175| out_samples [1] = tmp = (dpp->samples_B [k] = in_samples [1]) - apply_weight (dpp->weight_B, sam); # 176|-> update_weight (dpp->weight_B, dpp->delta, sam, tmp); # 177| dpp->sum_B += dpp->weight_B; # 178| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:208: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 206| sam_A = dpp->samples_A [0]; # 207| out_samples [0] = tmp = (sam_B = in_samples [0]) - apply_weight (dpp->weight_A, sam_A); # 208|-> update_weight_clip (dpp->weight_A, dpp->delta, sam_A, tmp); # 209| dpp->sum_A += dpp->weight_A; # 210| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:212: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 210| # 211| out_samples [1] = tmp = (dpp->samples_A [0] = in_samples [1]) - apply_weight (dpp->weight_B, sam_B); # 212|-> update_weight_clip (dpp->weight_B, dpp->delta, sam_B, tmp); # 213| dpp->sum_B += dpp->weight_B; # 214| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:227: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 225| sam_B = dpp->samples_B [0]; # 226| out_samples [1] = tmp = (sam_A = in_samples [1]) - apply_weight (dpp->weight_B, sam_B); # 227|-> update_weight_clip (dpp->weight_B, dpp->delta, sam_B, tmp); # 228| dpp->sum_B += dpp->weight_B; # 229| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:231: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 229| # 230| out_samples [0] = tmp = (dpp->samples_B [0] = in_samples [0]) - apply_weight (dpp->weight_A, sam_A); # 231|-> update_weight_clip (dpp->weight_A, dpp->delta, sam_A, tmp); # 232| dpp->sum_A += dpp->weight_A; # 233| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:249: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 247| dpp->samples_A [0] = tmp = in_samples [1]; # 248| out_samples [1] = tmp -= apply_weight (dpp->weight_B, sam_B); # 249|-> update_weight_clip (dpp->weight_B, dpp->delta, sam_B, tmp); # 250| dpp->sum_B += dpp->weight_B; # 251| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:254: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 252| dpp->samples_B [0] = tmp = in_samples [0]; # 253| out_samples [0] = tmp -= apply_weight (dpp->weight_A, sam_A); # 254|-> update_weight_clip (dpp->weight_A, dpp->delta, sam_A, tmp); # 255| dpp->sum_A += dpp->weight_A; # 256| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c: scope_hint: In function 'analyze_stereo' wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:601:5: warning[-Wanalyzer-null-argument]: use of NULL 'samples' where non-null expected <built-in>: note: argument 2 of '__builtin_memcpy' must be non-null # 599| # 600| memcpy (info.dps, wps->decorr_passes, sizeof (info.dps)); # 601|-> memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 8); # 602| # 603| for (i = 0; i < info.nterms && info.dps [i].term; ++i) Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:601:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'info.sampleptrs[0]' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 599| # 600| memcpy (info.dps, wps->decorr_passes, sizeof (info.dps)); # 601|-> memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 8); # 602| # 603| for (i = 0; i < info.nterms && info.dps [i].term; ++i) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:601:5: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 599| # 600| memcpy (info.dps, wps->decorr_passes, sizeof (info.dps)); # 601|-> memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 8); # 602| # 603| for (i = 0; i < info.nterms && info.dps [i].term; ++i) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:601:5: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 599| # 600| memcpy (info.dps, wps->decorr_passes, sizeof (info.dps)); # 601|-> memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 8); # 602| # 603| for (i = 0; i < info.nterms && info.dps [i].term; ++i) Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:601:29: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'info.sampleptrs[0]' # 599| # 600| memcpy (info.dps, wps->decorr_passes, sizeof (info.dps)); # 601|-> memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 8); # 602| # 603| for (i = 0; i < info.nterms && info.dps [i].term; ++i) Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:604:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'info.sampleptrs[<unknown>]' # 602| # 603| for (i = 0; i < info.nterms && info.dps [i].term; ++i) # 604|-> decorr_stereo_pass (info.sampleptrs [i], info.sampleptrs [i + 1], wps->wphdr.block_samples, info.dps + i, 1); # 605| # 606| info.best_bits = LOG2BUFFER (info.sampleptrs [info.nterms], wps->wphdr.block_samples * 2, 0) * 1; Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:606:22: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 604| decorr_stereo_pass (info.sampleptrs [i], info.sampleptrs [i + 1], wps->wphdr.block_samples, info.dps + i, 1); # 605| # 606|-> info.best_bits = LOG2BUFFER (info.sampleptrs [info.nterms], wps->wphdr.block_samples * 2, 0) * 1; # 607| info.best_bits += log2overhead (info.dps [0].term, i); # 608| memcpy (info.sampleptrs [info.nterms + 1], info.sampleptrs [i], wps->wphdr.block_samples * 8); Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c: scope_hint: In function 'execute_stereo' wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:806:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'js_buffer' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 804| # 805| lptr = js_buffer = malloc (buf_size); # 806|-> memcpy (js_buffer, noisy_buffer ? noisy_buffer : samples, buf_size); # 807| # 808| while (cnt--) { Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:817:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc((long unsigned int)buf_size)' where non-null expected wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:19: included_from: Included from here. wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:747:5: note: in expansion of macro 'CLEARA' <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 815| } # 816| else # 817|-> memcpy (temp_buffer [0], noisy_buffer ? noisy_buffer : samples, buf_size); # 818| # 819| CLEARA (save_decorr_passes); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/extra2.c:875:17: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 873| # 874| if (do_samples) # 875|-> memcpy (samples, js_buffer, buf_size); # 876| } # 877| else if (noisy_buffer) { Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/open_filename.c: scope_hint: In function 'WavpackOpenFileInput' wavpack-5.6.0-build/wavpack-5.6.0/src/open_filename.c:330:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'in2filename' where non-null expected <built-in>: note: argument 1 of '__builtin_strcpy' must be non-null # 328| char *in2filename = malloc (strlen (infilename) + 10); # 329| # 330|-> strcpy (in2filename, infilename); # 331| strcat (in2filename, "c"); # 332| wvc_id = fopen_func (in2filename, "rb"); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_legacy.c: scope_hint: In function 'WavpackOpenFileInputEx' wavpack-5.6.0-build/wavpack-5.6.0/src/open_legacy.c:103:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'trans_wv' # 101| if (wv_id) { # 102| trans_wv = (WavpackReaderTranslator *)malloc (sizeof (WavpackReaderTranslator)); # 103|-> trans_wv->reader = reader; # 104| trans_wv->id = wv_id; # 105| } Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_legacy.c:109:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'trans_wvc' # 107| if (wvc_id) { # 108| trans_wvc = (WavpackReaderTranslator *)malloc (sizeof (WavpackReaderTranslator)); # 109|-> trans_wvc->reader = reader; # 110| trans_wvc->id = wvc_id; # 111| } Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c: scope_hint: In function 'WavpackOpenRawDecoder' wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:151:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'raw_wv' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 149| # 150| raw_wv = malloc (sizeof (WavpackRawContext)); # 151|-> memset (raw_wv, 0, sizeof (WavpackRawContext)); # 152| # 153| if (corr_data && corr_size) { Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:155:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'raw_wvc' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 153| if (corr_data && corr_size) { # 154| raw_wvc = malloc (sizeof (WavpackRawContext)); # 155|-> memset (raw_wvc, 0, sizeof (WavpackRawContext)); # 156| } # 157| Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:205:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wphdr' # 203| memset (wphdr, 0, sizeof (WavpackHeader)); # 204| memcpy (wphdr->ckID, "wvpk", 4); # 205|-> wphdr->ckSize = sizeof (WavpackHeader) - 8 + block_size; # 206| SET_TOTAL_SAMPLES (*wphdr, block_samples); # 207| wphdr->block_samples = block_samples; Error: GCC_ANALYZER_WARNING (CWE-401): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:214:34: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' # 212| # 213| raw_wv->num_segments += 2; # 214|-> raw_wv->segments = realloc (raw_wv->segments, sizeof (RawSegment) * raw_wv->num_segments); # 215| raw_wv->segments [msi].dptr = raw_wv->segments [msi].sptr = (unsigned char *) wphdr; # 216| raw_wv->segments [msi].eptr = raw_wv->segments [msi].dptr + sizeof (WavpackHeader); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:215:75: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 213| raw_wv->num_segments += 2; # 214| raw_wv->segments = realloc (raw_wv->segments, sizeof (RawSegment) * raw_wv->num_segments); # 215|-> raw_wv->segments [msi].dptr = raw_wv->segments [msi].sptr = (unsigned char *) wphdr; # 216| raw_wv->segments [msi].eptr = raw_wv->segments [msi].dptr + sizeof (WavpackHeader); # 217| raw_wv->segments [msi++].free_required = 1; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:252:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wphdr' # 250| memset (wphdr, 0, sizeof (WavpackHeader)); # 251| memcpy (wphdr->ckID, "wvpk", 4); # 252|-> wphdr->ckSize = sizeof (WavpackHeader) - 8 + block_size; # 253| SET_TOTAL_SAMPLES (*wphdr, block_samples); # 254| wphdr->block_samples = block_samples; Error: GCC_ANALYZER_WARNING (CWE-416): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:260:28: warning[-Wanalyzer-use-after-free]: use after 'free' of 'raw_wvc' # 258| WavpackLittleEndianToNative (wphdr, WavpackHeaderFormat); # 259| # 260|-> raw_wvc->num_segments += 2; # 261| raw_wvc->segments = realloc (raw_wvc->segments, sizeof (RawSegment) * raw_wvc->num_segments); # 262| raw_wvc->segments [csi].dptr = raw_wvc->segments [csi].sptr = (unsigned char *) wphdr; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:262:81: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 260| raw_wvc->num_segments += 2; # 261| raw_wvc->segments = realloc (raw_wvc->segments, sizeof (RawSegment) * raw_wvc->num_segments); # 262|-> raw_wvc->segments [csi].dptr = raw_wvc->segments [csi].sptr = (unsigned char *) wphdr; # 263| raw_wvc->segments [csi].eptr = raw_wvc->segments [csi].dptr + sizeof (WavpackHeader); # 264| raw_wvc->segments [csi++].free_required = 1; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:285:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'raw_wv' # 283| raw_wv = malloc (sizeof (WavpackRawContext)); # 284| memset (raw_wv, 0, sizeof (WavpackRawContext)); # 285|-> raw_wv->num_segments = 1; # 286| raw_wv->segments = malloc (sizeof (RawSegment) * raw_wv->num_segments); # 287| raw_wv->segments [0].dptr = raw_wv->segments [0].sptr = main_data; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:287:67: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc(32)' # 285| raw_wv->num_segments = 1; # 286| raw_wv->segments = malloc (sizeof (RawSegment) * raw_wv->num_segments); # 287|-> raw_wv->segments [0].dptr = raw_wv->segments [0].sptr = main_data; # 288| raw_wv->segments [0].eptr = raw_wv->segments [0].dptr + main_size; # 289| raw_wv->segments [0].free_required = 0; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:295:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'raw_wvc' # 293| raw_wvc = malloc (sizeof (WavpackRawContext)); # 294| memset (raw_wvc, 0, sizeof (WavpackRawContext)); # 295|-> raw_wvc->num_segments = 1; # 296| raw_wvc->segments = malloc (sizeof (RawSegment) * raw_wvc->num_segments); # 297| raw_wvc->segments [0].dptr = raw_wvc->segments [0].sptr = corr_data; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_raw.c:297:69: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc(32)' # 295| raw_wvc->num_segments = 1; # 296| raw_wvc->segments = malloc (sizeof (RawSegment) * raw_wvc->num_segments); # 297|-> raw_wvc->segments [0].dptr = raw_wvc->segments [0].sptr = corr_data; # 298| raw_wvc->segments [0].eptr = raw_wvc->segments [0].dptr + corr_size; # 299| raw_wvc->segments [0].free_required = 0; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/open_utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/open_utils.c: scope_hint: In function 'read_channel_identities' wavpack-5.6.0-build/wavpack-5.6.0/src/open_utils.c:523:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*wpc.channel_identities' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 521| if (!wpc->channel_identities) { # 522| wpc->channel_identities = (unsigned char *)malloc (wpmd->byte_length + 1); # 523|-> memcpy (wpc->channel_identities, wpmd->data, wpmd->byte_length); # 524| wpc->channel_identities [wpmd->byte_length] = 0; # 525| } Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/open_utils.c: scope_hint: In function 'read_sample_rate' wavpack-5.6.0-build/wavpack-5.6.0/src/open_utils.c:639:45: warning[-Wanalyzer-null-dereference]: dereference of NULL 'byteptr' # 637| # 638| if (bytecnt == 3 || bytecnt == 4) { # 639|-> wpc->config.sample_rate = (int32_t) *byteptr++; # 640| wpc->config.sample_rate |= (int32_t) *byteptr++ << 8; # 641| wpc->config.sample_rate |= (int32_t) *byteptr++ << 16; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_decorr_terms' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:113:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'byteptr' # 111| # 112| for (dpp = wps->decorr_passes; tcount--; ++dpp) # 113|-> *byteptr++ = ((dpp->term + 5) & 0x1f) | ((dpp->delta << 5) & 0xe0); # 114| # 115| wpmd->byte_length = (int32_t)(byteptr - (char *) wpmd->data); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_int32_info' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:284:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 282| byteptr = wpmd->data = malloc (4); # 283| wpmd->id = ID_INT32_INFO; # 284|-> *byteptr++ = wps->int32_sent_bits; # 285| *byteptr++ = wps->int32_zeros; # 286| *byteptr++ = wps->int32_ones; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_float_info' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:297:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 295| byteptr = wpmd->data = malloc (4); # 296| wpmd->id = ID_FLOAT_INFO; # 297|-> *byteptr++ = wps->float_flags; # 298| *byteptr++ = wps->float_shift; # 299| *byteptr++ = wps->float_max_exp; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_channel_info' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:317:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 315| # 316| if (wpc->num_streams > OLD_MAX_STREAMS) { // if > 8 streams, use 6 or 7 bytes (breaks old decoders # 317|-> *byteptr++ = wpc->config.num_channels - 1; // that could only handle 8 streams) and allow (in theory) # 318| *byteptr++ = wpc->num_streams - 1; // up to 4096 channels # 319| *byteptr++ = (((wpc->num_streams - 1) >> 4) & 0xf0) | (((wpc->config.num_channels - 1) >> 8) & 0xf); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:328:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 326| } # 327| else { // otherwise use only 1 to 5 bytes # 328|-> *byteptr++ = wpc->config.num_channels; # 329| # 330| while (mask) { Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_config_info' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:364:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 362| byteptr = wpmd->data = malloc (8); # 363| wpmd->id = ID_CONFIG_BLOCK; # 364|-> *byteptr++ = (char) (wpc->config.flags >> 8); # 365| *byteptr++ = (char) (wpc->config.flags >> 16); # 366| *byteptr++ = (char) (wpc->config.flags >> 24); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_new_config_info' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:391:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 389| # 390| if (wpc->file_format || (wpc->config.qmode & 0xff) || wpc->channel_layout) { # 391|-> *byteptr++ = (char) wpc->file_format; # 392| *byteptr++ = (char) wpc->config.qmode; # 393| Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'write_sample_rate' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:434:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'wpmd.data' # 432| byteptr = wpmd->data = malloc (4); # 433| wpmd->id = ID_SAMPLE_RATE; # 434|-> *byteptr++ = (char) (wpc->config.sample_rate); # 435| *byteptr++ = (char) (wpc->config.sample_rate >> 8); # 436| *byteptr++ = (char) (wpc->config.sample_rate >> 16); Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:551:14: warning[deadcode.DeadStores]: Although the value stored to 'mag' is used in the enclosing expression, the value is never actually read from 'mag' # 549| } # 550| # 551|-> if ((mag -= shift) < 0) # 552| flags &= ~MAG_MASK; # 553| else Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'pack_block' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:573:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'orig_data' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 571| if ((!(flags & HYBRID_FLAG) || wpc->wvc_flag) && !(wpc->config.flags & CONFIG_SKIP_WVX)) { # 572| orig_data = malloc (sizeof (f32) * ((flags & MONO_DATA) ? sample_count : sample_count * 2)); # 573|-> memcpy (orig_data, buffer, sizeof (f32) * ((flags & MONO_DATA) ? sample_count : sample_count * 2)); # 574| # 575| if (flags & FLOAT_DATA) { // if lossless float data come here Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c: scope_hint: In function 'pack_samples' wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1062:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'saved_buffer' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 1060| if (repack_possible && !(flags & HYBRID_FLAG)) { # 1061| saved_buffer = malloc (sample_count * sizeof (int32_t) * (flags & MONO_DATA ? 1 : 2)); # 1062|-> memcpy (saved_buffer, buffer, sample_count * sizeof (int32_t) * (flags & MONO_DATA ? 1 : 2)); # 1063| } # 1064| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1207: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1205| while (--dpp >= wps->decorr_passes) { # 1206| if (dpp->term > MAX_TERM) { # 1207|-> update_weight (dpp->weight_A, dpp->delta, dpp->samples_A [2], code); # 1208| dpp->samples_A [1] = dpp->samples_A [0]; # 1209| dpp->samples_A [0] = (code += dpp->aweight_A); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1214: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1212| int32_t sam = dpp->samples_A [m]; # 1213| # 1214|-> update_weight (dpp->weight_A, dpp->delta, sam, code); # 1215| dpp->samples_A [(m + dpp->term) & (MAX_TERM - 1)] = (code += dpp->aweight_A); # 1216| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1317: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1315| while (--dpp >= wps->decorr_passes) # 1316| if (dpp->term > MAX_TERM) { # 1317|-> update_weight (dpp->weight_A, dpp->delta, dpp->samples_A [2], left); # 1318| update_weight (dpp->weight_B, dpp->delta, dpp->samples_B [2], right); # 1319| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1318: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1316| if (dpp->term > MAX_TERM) { # 1317| update_weight (dpp->weight_A, dpp->delta, dpp->samples_A [2], left); # 1318|-> update_weight (dpp->weight_B, dpp->delta, dpp->samples_B [2], right); # 1319| # 1320| dpp->samples_A [1] = dpp->samples_A [0]; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1329: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1327| int k = (m + dpp->term) & (MAX_TERM - 1); # 1328| # 1329|-> update_weight (dpp->weight_A, dpp->delta, dpp->samples_A [m], left); # 1330| dpp->samples_A [k] = (left += dpp->aweight_A); # 1331| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1332: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1330| dpp->samples_A [k] = (left += dpp->aweight_A); # 1331| # 1332|-> update_weight (dpp->weight_B, dpp->delta, dpp->samples_B [m], right); # 1333| dpp->samples_B [k] = (right += dpp->aweight_B); # 1334| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1345: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1343| } # 1344| # 1345|-> update_weight_clip (dpp->weight_A, dpp->delta, dpp->samples_A [0], left); # 1346| update_weight_clip (dpp->weight_B, dpp->delta, dpp->samples_B [0], right); # 1347| dpp->samples_B [0] = (left += dpp->aweight_A); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack.c:1346: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 1344| # 1345| update_weight_clip (dpp->weight_A, dpp->delta, dpp->samples_A [0], left); # 1346|-> update_weight_clip (dpp->weight_B, dpp->delta, dpp->samples_B [0], right); # 1347| dpp->samples_B [0] = (left += dpp->aweight_A); # 1348| dpp->samples_A [0] = (right += dpp->aweight_B); Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c:39: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 37| sam = (3 * bptr [1] - bptr [2]) >> 1; # 38| temp = *bptr-- - apply_weight (ap->weight_A, sam); # 39|-> update_weight (ap->weight_A, 2, sam, temp); # 40| } # 41| else Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c:45: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 43| sam = (3 * bptr [2] - bptr [4]) >> 1; # 44| temp = *bptr-- - apply_weight (ap->weight_B, sam); # 45|-> update_weight (ap->weight_B, 2, sam, temp); # 46| sam = (3 * bptr [2] - bptr [4]) >> 1; # 47| temp = *bptr-- - apply_weight (ap->weight_A, sam); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c:48: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 46| sam = (3 * bptr [2] - bptr [4]) >> 1; # 47| temp = *bptr-- - apply_weight (ap->weight_A, sam); # 48|-> update_weight (ap->weight_A, 2, sam, temp); # 49| } # 50| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c:61: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 59| sam = (3 * ap->samples_A [0] - ap->samples_A [1]) >> 1; # 60| temp = *bptr - apply_weight (ap->weight_A, sam); # 61|-> update_weight (ap->weight_A, 2, sam, temp); # 62| ap->samples_A [1] = ap->samples_A [0]; # 63| ap->samples_A [0] = *bptr++; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c:70: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 68| sam = (3 * ap->samples_A [0] - ap->samples_A [1]) >> 1; # 69| temp = *bptr - apply_weight (ap->weight_A, sam); # 70|-> update_weight (ap->weight_A, 2, sam, temp); # 71| ap->samples_A [1] = ap->samples_A [0]; # 72| ap->samples_A [0] = *bptr++; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dns.c:76: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 74| sam = (3 * ap->samples_B [0] - ap->samples_B [1]) >> 1; # 75| temp = *bptr - apply_weight (ap->weight_B, sam); # 76|-> update_weight (ap->weight_B, 2, sam, temp); # 77| ap->samples_B [1] = ap->samples_B [0]; # 78| ap->samples_B [0] = *bptr++; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c: scope_hint: In function 'calculate_probabilities' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:218:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'probs' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 216| # 217| if (max_hits == 0) { # 218|-> memset (probs, 0, sizeof (*probs) * 256); # 219| memset (prob_sums, 0, sizeof (*prob_sums) * 256); # 220| return; Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:219:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'prob_sums' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 217| if (max_hits == 0) { # 218| memset (probs, 0, sizeof (*probs) * 256); # 219|-> memset (prob_sums, 0, sizeof (*prob_sums) * 256); # 220| return; # 221| } Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:250:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'prob_sums' # 248| value = 0; # 249| # 250|-> prob_sums [i] = sum_values += value; # 251| probs [i] = value; # 252| } Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:251:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'probs' # 249| # 250| prob_sums [i] = sum_values += value; # 251|-> probs [i] = value; # 252| } # 253| Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c: scope_hint: In function 'encode_buffer_fast' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:324:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'histogram' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 322| history_bins = 1 << history_bits; # 323| histogram = malloc (sizeof (*histogram) * history_bins); # 324|-> memset (histogram, 0, sizeof (*histogram) * history_bins); # 325| probabilities = malloc (sizeof (*probabilities) * history_bins); # 326| summed_probabilities = malloc (sizeof (*summed_probabilities) * history_bins); Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:346:65: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*<unknown>[255]' # 344| for (p0 = 0; p0 < history_bins; p0++) { # 345| calculate_probabilities (histogram [p0], probabilities [p0], summed_probabilities [p0]); # 346|-> total_summed_probabilities += summed_probabilities [p0] [255]; # 347| } # 348| Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c: scope_hint: In function 'init_ptable' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:470:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'table' # 468| # 469| for (i = 0; i < PTABLE_BINS/2; ++i) { # 470|-> table [i] = value; # 471| table [PTABLE_BINS-1-i] = 0x100ffff - value; # 472| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:601: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 599| # 600| sp [0].value += sp [0].filter6 * 8; # 601|-> sp [0].factor += (((sp [0].value ^ sp [0].filter0) >> 31) | 1) & ((sp [0].value ^ (sp [0].value - (sp [0].filter6 * 16))) >> 31); # 602| sp [0].filter1 += ((sp [0].filter0 & VALUE_ONE) - sp [0].filter1) >> 6; # 603| sp [0].filter2 += ((sp [0].filter0 & VALUE_ONE) - sp [0].filter2) >> 4; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_dsd.c:635: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 633| # 634| sp [1].value += sp [1].filter6 * 8; # 635|-> sp [1].factor += (((sp [1].value ^ sp [1].filter0) >> 31) | 1) & ((sp [1].value ^ (sp [1].value - (sp [1].filter6 * 16))) >> 31); # 636| sp [1].filter1 += ((sp [1].filter0 & VALUE_ONE) - sp [1].filter1) >> 6; # 637| sp [1].filter2 += ((sp [1].filter0 & VALUE_ONE) - sp [1].filter2) >> 4; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/pack_floats.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_floats.c:48: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 46| // max magnitude that does not have an exponent of 255 (reserved for +/-inf and NaN). # 47| for (dp = values, count = num_values; count--; dp++) { # 48|-> crc = crc * 27 + get_mantissa (*dp) * 9 + get_exponent (*dp) * 3 + get_sign (*dp); # 49| # 50| if (get_exponent (*dp) < 255 && get_magnitude (*dp) > max_mag) Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_floats.c:105: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 103| if (get_exponent (*dp) || get_mantissa (*dp)) # 104| ++false_zeros; # 105|-> else if (get_sign (*dp)) # 106| ++neg_zeros; # 107| #ifdef DISPLAY_DIAGNOSTICS Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_floats.c:130: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 128| # 129| ordata |= value; # 130|-> * (int32_t *) dp = (get_sign (*dp)) ? -value : value; # 131| } # 132| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_floats.c:250: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 248| } # 249| # 250|-> putbit (get_sign (*dp), &wps->wvxbits); # 251| } # 252| else { Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_floats.c:256: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 254| # 255| if (wps->float_flags & FLOAT_NEG_ZEROS) # 256|-> putbit (get_sign (*dp), &wps->wvxbits); # 257| } # 258| } Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c: scope_hint: In function 'WavpackUpdateNumSamples' wavpack-5.6.0-build/wavpack-5.6.0/src/pack_utils.c:1064:13: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 1062| # 1063| if (wrapper_size == create_riff_header (wpc, WavpackGetSampleIndex64 (wpc), riff_header)) # 1064|-> memcpy (WavpackGetWrapperLocation (first_block, NULL), riff_header, wrapper_size); # 1065| } # 1066| Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/read_words.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/tag_utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/tag_utils.c:471:13: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 469| m_tag->ape_tag_hdr.flags |= APE_TAG_THIS_IS_HEADER; # 470| WavpackNativeToLittleEndian (&m_tag->ape_tag_hdr, APE_Tag_Hdr_Format); # 471|-> result = wpc->blockout (wpc->wv_out, &m_tag->ape_tag_hdr, sizeof (m_tag->ape_tag_hdr)); # 472| WavpackLittleEndianToNative (&m_tag->ape_tag_hdr, APE_Tag_Hdr_Format); # 473| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/tag_utils.c:476:13: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 474| # 475| if (m_tag->ape_tag_hdr.length > sizeof (m_tag->ape_tag_hdr)) # 476|-> result = wpc->blockout (wpc->wv_out, m_tag->ape_tag_data, m_tag->ape_tag_hdr.length - sizeof (m_tag->ape_tag_hdr)); # 477| # 478| m_tag->ape_tag_hdr.flags &= ~APE_TAG_THIS_IS_HEADER; // this is NOT header Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/tag_utils.c:538:13: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 536| m_tag->ape_tag_hdr.flags |= APE_TAG_THIS_IS_HEADER; # 537| WavpackNativeToLittleEndian (&m_tag->ape_tag_hdr, APE_Tag_Hdr_Format); # 538|-> result = (wpc->reader->write_bytes (wpc->wv_in, &m_tag->ape_tag_hdr, sizeof (m_tag->ape_tag_hdr)) == sizeof (m_tag->ape_tag_hdr)); # 539| WavpackLittleEndianToNative (&m_tag->ape_tag_hdr, APE_Tag_Hdr_Format); # 540| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/tag_utils.c:542:9: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 540| } # 541| # 542|-> result = (wpc->reader->write_bytes (wpc->wv_in, m_tag->ape_tag_data, m_tag->ape_tag_hdr.length - sizeof (m_tag->ape_tag_hdr)) == sizeof (m_tag->ape_tag_hdr)); # 543| m_tag->ape_tag_hdr.flags &= ~APE_TAG_THIS_IS_HEADER; // this is NOT header # 544| WavpackNativeToLittleEndian (&m_tag->ape_tag_hdr, APE_Tag_Hdr_Format); Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/tags.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:251: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 249| # 250| temp = apply_weight (dpp->weight_A, sam) + read_word; # 251|-> update_weight (dpp->weight_A, dpp->delta, sam, read_word); # 252| dpp->samples_A [k] = read_word = temp; # 253| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:367: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 365| right2 = apply_weight (dpp->weight_B, sam_B) + right; # 366| # 367|-> update_weight (dpp->weight_A, dpp->delta, sam_A, left); # 368| update_weight (dpp->weight_B, dpp->delta, sam_B, right); # 369| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:368: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 366| # 367| update_weight (dpp->weight_A, dpp->delta, sam_A, left); # 368|-> update_weight (dpp->weight_B, dpp->delta, sam_B, right); # 369| # 370| dpp->samples_A [k] = left = left2; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:375: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 373| else if (dpp->term == -1) { # 374| left2 = left + apply_weight (dpp->weight_A, dpp->samples_A [0]); # 375|-> update_weight_clip (dpp->weight_A, dpp->delta, dpp->samples_A [0], left); # 376| left = left2; # 377| right2 = right + apply_weight (dpp->weight_B, left2); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:378: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 376| left = left2; # 377| right2 = right + apply_weight (dpp->weight_B, left2); # 378|-> update_weight_clip (dpp->weight_B, dpp->delta, left2, right); # 379| dpp->samples_A [0] = right = right2; # 380| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:383: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 381| else { # 382| right2 = right + apply_weight (dpp->weight_B, dpp->samples_B [0]); # 383|-> update_weight_clip (dpp->weight_B, dpp->delta, dpp->samples_B [0], right); # 384| right = right2; # 385| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:392: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 390| # 391| left2 = left + apply_weight (dpp->weight_A, right2); # 392|-> update_weight_clip (dpp->weight_A, dpp->delta, right2, left); # 393| dpp->samples_B [0] = left = left2; # 394| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:526: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 524| dpp->samples_A [1] = dpp->samples_A [0]; # 525| dpp->samples_A [0] = apply_weight (weight_A, sam_A) + bptr [0]; # 526|-> update_weight (weight_A, delta, sam_A, bptr [0]); # 527| bptr [0] = dpp->samples_A [0]; # 528| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:537: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 535| dpp->samples_A [1] = dpp->samples_A [0]; # 536| dpp->samples_A [0] = apply_weight (weight_A, sam_A) + bptr [0]; # 537|-> update_weight (weight_A, delta, sam_A, bptr [0]); # 538| bptr [0] = dpp->samples_A [0]; # 539| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:547: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 545| sam_A = dpp->samples_A [m]; # 546| dpp->samples_A [k] = apply_weight (weight_A, sam_A) + bptr [0]; # 547|-> update_weight (weight_A, delta, sam_A, bptr [0]); # 548| bptr [0] = dpp->samples_A [k]; # 549| m = (m + 1) & (MAX_TERM - 1); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:588: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 586| dpp->samples_A [1] = dpp->samples_A [0]; # 587| bptr [0] = dpp->samples_A [0] = apply_weight (dpp->weight_A, sam) + (tmp = bptr [0]); # 588|-> update_weight (dpp->weight_A, dpp->delta, sam, tmp); # 589| # 590| sam = 2 * dpp->samples_B [0] - dpp->samples_B [1]; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:593: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 591| dpp->samples_B [1] = dpp->samples_B [0]; # 592| bptr [1] = dpp->samples_B [0] = apply_weight (dpp->weight_B, sam) + (tmp = bptr [1]); # 593|-> update_weight (dpp->weight_B, dpp->delta, sam, tmp); # 594| } # 595| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:605: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 603| dpp->samples_A [1] = dpp->samples_A [0]; # 604| bptr [0] = dpp->samples_A [0] = apply_weight (dpp->weight_A, sam) + (tmp = bptr [0]); # 605|-> update_weight (dpp->weight_A, dpp->delta, sam, tmp); # 606| # 607| sam = dpp->samples_B [0] + ((dpp->samples_B [0] - dpp->samples_B [1]) >> 1); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:610: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 608| dpp->samples_B [1] = dpp->samples_B [0]; # 609| bptr [1] = dpp->samples_B [0] = apply_weight (dpp->weight_B, sam) + (tmp = bptr [1]); # 610|-> update_weight (dpp->weight_B, dpp->delta, sam, tmp); # 611| } # 612| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:621: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 619| sam = dpp->samples_A [m]; # 620| dpp->samples_A [k] = apply_weight (dpp->weight_A, sam) + bptr [0]; # 621|-> update_weight (dpp->weight_A, dpp->delta, sam, bptr [0]); # 622| bptr [0] = dpp->samples_A [k]; # 623| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:626: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 624| sam = dpp->samples_B [m]; # 625| dpp->samples_B [k] = apply_weight (dpp->weight_B, sam) + bptr [1]; # 626|-> update_weight (dpp->weight_B, dpp->delta, sam, bptr [1]); # 627| bptr [1] = dpp->samples_B [k]; # 628| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:640: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 638| # 639| sam = bptr [0] + apply_weight (dpp->weight_A, dpp->samples_A [0]); # 640|-> update_weight_clip (dpp->weight_A, dpp->delta, dpp->samples_A [0], bptr [0]); # 641| bptr [0] = sam; # 642| dpp->samples_A [0] = bptr [1] + apply_weight (dpp->weight_B, sam); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:643: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 641| bptr [0] = sam; # 642| dpp->samples_A [0] = bptr [1] + apply_weight (dpp->weight_B, sam); # 643|-> update_weight_clip (dpp->weight_B, dpp->delta, sam, bptr [1]); # 644| bptr [1] = dpp->samples_A [0]; # 645| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:654: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 652| # 653| sam = bptr [1] + apply_weight (dpp->weight_B, dpp->samples_B [0]); # 654|-> update_weight_clip (dpp->weight_B, dpp->delta, dpp->samples_B [0], bptr [1]); # 655| bptr [1] = sam; # 656| dpp->samples_B [0] = bptr [0] + apply_weight (dpp->weight_A, sam); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:657: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 655| bptr [1] = sam; # 656| dpp->samples_B [0] = bptr [0] + apply_weight (dpp->weight_A, sam); # 657|-> update_weight_clip (dpp->weight_A, dpp->delta, sam, bptr [0]); # 658| bptr [0] = dpp->samples_B [0]; # 659| } Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:668: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 666| # 667| sam_A = bptr [0] + apply_weight (dpp->weight_A, dpp->samples_A [0]); # 668|-> update_weight_clip (dpp->weight_A, dpp->delta, dpp->samples_A [0], bptr [0]); # 669| sam_B = bptr [1] + apply_weight (dpp->weight_B, dpp->samples_B [0]); # 670| update_weight_clip (dpp->weight_B, dpp->delta, dpp->samples_B [0], bptr [1]); Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:670: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 668| update_weight_clip (dpp->weight_A, dpp->delta, dpp->samples_A [0], bptr [0]); # 669| sam_B = bptr [1] + apply_weight (dpp->weight_B, dpp->samples_B [0]); # 670|-> update_weight_clip (dpp->weight_B, dpp->delta, dpp->samples_B [0], bptr [1]); # 671| bptr [0] = dpp->samples_B [0] = sam_A; # 672| bptr [1] = dpp->samples_A [0] = sam_B; Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack.c:711:21: warning[core.BitwiseShift]: Left shift overflows the capacity of 'uint32_t' # 709| while (count--) { # 710| // if (sent_bits) { # 711|-> getbits (&data, sent_bits, &wps->wvxbits); # 712| *dptr = ((uint32_t) *dptr << sent_bits) | (data & mask); # 713| // } Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c: scope_hint: In function 'init_dsd_block_fast' wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:150:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*wps.dsd.value_lookup' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 148| lb_ptr = wps->dsd.lookup_buffer = (unsigned char *)malloc (wps->dsd.history_bins * MAX_BYTES_PER_BIN); # 149| wps->dsd.value_lookup = (unsigned char **)malloc (sizeof (*wps->dsd.value_lookup) * wps->dsd.history_bins); # 150|-> memset (wps->dsd.value_lookup, 0, sizeof (*wps->dsd.value_lookup) * wps->dsd.history_bins); # 151| wps->dsd.summed_probabilities = (uint16_t (*)[256])malloc (sizeof (*wps->dsd.summed_probabilities) * wps->dsd.history_bins); # 152| wps->dsd.probabilities = (unsigned char (*)[256])malloc (sizeof (*wps->dsd.probabilities) * wps->dsd.history_bins); Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:167:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' # 165| # 166| while (outptr < outend && zcount--) # 167|-> *outptr++ = 0; # 168| } # 169| else if (code) Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:170:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' # 168| } # 169| else if (code) # 170|-> *outptr++ = code; # 171| else # 172| break; Error: GCC_ANALYZER_WARNING (CWE-688): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:179:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*wps.dsd.probabilities' where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 177| } # 178| else if (wps->dsd.endptr - wps->dsd.byteptr > (int) sizeof (*wps->dsd.probabilities) * wps->dsd.history_bins) { # 179|-> memcpy (wps->dsd.probabilities, wps->dsd.byteptr, sizeof (*wps->dsd.probabilities) * wps->dsd.history_bins); # 180| wps->dsd.byteptr += sizeof (*wps->dsd.probabilities) * wps->dsd.history_bins; # 181| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:189:65: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 187| # 188| for (sum_values = i = 0; i < 256; ++i) # 189|-> wps->dsd.summed_probabilities [bi] [i] = sum_values += wps->dsd.probabilities [bi] [i]; # 190| # 191| if (sum_values) { Error: GCC_ANALYZER_WARNING (CWE-457): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:189:96: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*<unknown>[i]' # 187| # 188| for (sum_values = i = 0; i < 256; ++i) # 189|-> wps->dsd.summed_probabilities [bi] [i] = sum_values += wps->dsd.probabilities [bi] [i]; # 190| # 191| if (sum_values) { Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c: scope_hint: In function 'init_ptable' wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:299:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'table' # 297| # 298| for (i = 0; i < PTABLE_BINS/2; ++i) { # 299|-> table [i] = value; # 300| table [PTABLE_BINS-1-i] = 0x100ffff - value; # 301| Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:391: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 389| sp [0].value += sp [0].filter6 * 8; # 390| sp [0].byte = (sp [0].byte << 1) | (sp [0].filter0 & 1); # 391|-> sp [0].factor += (((sp [0].value ^ sp [0].filter0) >> 31) | 1) & ((sp [0].value ^ (sp [0].value - (sp [0].filter6 * 16))) >> 31); # 392| sp [0].filter1 += ((sp [0].filter0 & VALUE_ONE) - sp [0].filter1) >> 6; # 393| sp [0].filter2 += ((sp [0].filter0 & VALUE_ONE) - sp [0].filter2) >> 4; Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_dsd.c:426: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 424| sp [1].value += sp [1].filter6 * 8; # 425| sp [1].byte = (sp [1].byte << 1) | (sp [1].filter0 & 1); # 426|-> sp [1].factor += (((sp [1].value ^ sp [1].filter0) >> 31) | 1) & ((sp [1].value ^ (sp [1].value - (sp [1].filter6 * 16))) >> 31); # 427| sp [1].filter1 += ((sp [1].filter0 & VALUE_ONE) - sp [1].filter1) >> 6; # 428| sp [1].filter2 += ((sp [1].filter0 & VALUE_ONE) - sp [1].filter2) >> 4; Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_floats.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_floats.c:91: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 89| } # 90| # 91|-> crc = crc * 27 + get_mantissa (outval) * 9 + get_exponent (outval) * 3 + get_sign (outval); # 92| * (f32 *) values++ = outval; # 93| } Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_seek.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_seek.c:67:10: warning[core.NullDereference]: Dereference of null pointer # 65| #endif # 66| # 67|-> if (!wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) || sample < GET_BLOCK_INDEX (wps->wphdr) || # 68| sample >= GET_BLOCK_INDEX (wps->wphdr) + wps->wphdr.block_samples) { # 69| Error: COMPILER_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_seek.c: scope_hint: In function 'find_header' wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_seek.c:306:59: warning[-Wuse-after-free]: pointer 'ep_95' used after 'free' # 306 | return reader->get_pos (id) - (ep - sp + 4); # | ~~~^~~~ wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_seek.c:305:25: note: call to 'free' here # 305 | free (buffer); # | ^~~~~~~~~~~~~ # 304| if (wphdr->block_samples && (wphdr->flags & INITIAL_BLOCK)) { # 305| free (buffer); # 306|-> return reader->get_pos (id) - (ep - sp + 4); # 307| } # 308| Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c:57:14: warning[core.NullDereference]: Dereference of null pointer # 55| // to free up the streams and read the next block # 56| # 57|-> if (!wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) || # 58| wps->sample_index >= GET_BLOCK_INDEX (wps->wphdr) + wps->wphdr.block_samples) { # 59| Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c: scope_hint: In function 'WavpackUnpackSamples' wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c:58:16: warning[-Wanalyzer-null-dereference]: dereference of NULL 'wps' # 56| # 57| if (!wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) || # 58|-> wps->sample_index >= GET_BLOCK_INDEX (wps->wphdr) + wps->wphdr.block_samples) { # 59| # 60| int64_t nexthdrpos; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c:76:32: warning[-Wanalyzer-null-dereference]: dereference of NULL 'wps' # 74| // allocate the memory for the entire raw block and read it in # 75| # 76|-> wps->blockbuff = (unsigned char *)malloc (wps->wphdr.ckSize + 8); # 77| # 78| if (!wps->blockbuff) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c:327:21: warning[core.NullDereference]: Dereference of null pointer # 325| # 326| if (offset != num_channels) { # 327|-> if (wps->wphdr.flags & DSD_FLAG) { # 328| int samples_to_zero = samples_to_unpack * num_channels; # 329| int32_t *zptr = bptr; Error: GCC_ANALYZER_WARNING (CWE-476): wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c:343:17: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 341| // and free the temp buffer # 342| # 343|-> wps = wpc->streams [wpc->current_stream = 0]; # 344| free (temp_buffer); # 345| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/unpack_utils.c:343:19: warning[core.NullDereference]: Array access (via field 'streams') results in a null pointer dereference # 341| // and free the temp buffer # 342| # 343|-> wps = wpc->streams [wpc->current_stream = 0]; # 344| free (temp_buffer); # 345| } Error: CPPCHECK_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/write_words.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/write_words.c:431:59: warning[core.BitwiseShift]: Right operand is negative in left shift # 429| wps->w.pend_data |= ((code + extras) >> 1) << wps->w.pend_count; # 430| wps->w.pend_count += bitcount - 1; # 431|-> wps->w.pend_data |= ((code + extras) & 1) << wps->w.pend_count++; # 432| } # 433| } Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/write_words.c:435:45: warning[core.BitwiseShift]: Right operand is negative in left shift # 433| } # 434| # 435|-> wps->w.pend_data |= ((int32_t) sign << wps->w.pend_count++); # 436| # 437| if (!wps->w.holding_zero) Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/write_words.c:604:32: warning[deadcode.DeadStores]: Although the value stored to 'chan' is used in the enclosing expression, the value is never actually read from 'chan' # 602| while (num_samples--) { # 603| # 604|-> value = labs (samples [chan = 0]); # 605| # 606| if (flags & HYBRID_BITRATE) { Error: CLANG_WARNING: wavpack-5.6.0-build/wavpack-5.6.0/src/write_words.c:635:36: warning[deadcode.DeadStores]: Although the value stored to 'chan' is used in the enclosing expression, the value is never actually read from 'chan' # 633| # 634| if (!(flags & MONO_DATA)) { # 635|-> value = labs (samples [chan = 1]); # 636| c++; # 637|