Task #1308 - added.err

back to task #1308
download
Error: GCC_ANALYZER_WARNING (CWE-131):
wavpack-5.7.0-build/wavpack-5.7.0/cli/import_id3.c: scope_hint: In function ‘ID3v2StringsToUTF8’
wavpack-5.7.0-build/wavpack-5.7.0/cli/import_id3.c:556:23: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
#  554|               return -1;
#  555|   
#  556|->         wide_string = malloc (src_length + 2);
#  557|   
#  558|           while (fp <= fe - 2 && (!num_segments || fp [0] || fp [1])) {

Error: CLANG_WARNING:
wavpack-5.7.0-build/wavpack-5.7.0/cli/import_id3.c:598:12: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value
#  596|       int outndx = 0;
#  597|   
#  598|->     while (*pWide) {
#  599|           if (*pWide < 0x80 && outndx + 1 < len)
#  600|               pUTF8 [outndx++] = (unsigned char) *pWide++;

Error: CLANG_WARNING:
wavpack-5.7.0-build/wavpack-5.7.0/cli/wavpack.c:3668:71: warning[core.DivideZero]: Division by zero
# 3666|                       }
# 3667|   
# 3668|->                     sample_count = (uint32_t) ((dptr - format_buffer) / num_channels);
# 3669|                   }
# 3670|                   else {

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/extra1.c: scope_hint: In function 'analyze_mono'
wavpack-5.7.0-build/wavpack-5.7.0/src/extra1.c:433:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'info.sampleptrs[*wps.mask_decorr]' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  431|   
#  432|       memcpy (info.dps, wps->decorr_passes, sizeof (info.dps));
#  433|->     memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 4);
#  434|   
#  435|       for (i = 0; i < info.nterms && info.dps [i].term; ++i)

Error: GCC_ANALYZER_WARNING (CWE-457):
wavpack-5.7.0-build/wavpack-5.7.0/src/extra1.c:433:29: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'info.sampleptrs[0]'
#  431|   
#  432|       memcpy (info.dps, wps->decorr_passes, sizeof (info.dps));
#  433|->     memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 4);
#  434|   
#  435|       for (i = 0; i < info.nterms && info.dps [i].term; ++i)

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/extra2.c:597:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'info.sampleptrs[*wps.best_decorr]' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  595|   
#  596|       memcpy (info.dps, wps->decorr_passes, sizeof (info.dps));
#  597|->     memcpy (info.sampleptrs [0], samples, wps->wphdr.block_samples * 8);
#  598|   
#  599|       for (i = 0; i < info.nterms && info.dps [i].term; ++i)

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c: scope_hint: In function 'pack_streams'
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1167:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'wps_copy' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1165|               WavpackStream *wps_copy = malloc (sizeof (WavpackStream));
# 1166|   
# 1167|->             memcpy (wps_copy, wps, sizeof (WavpackStream));
# 1168|   
# 1169|               // If there is a discontinuity (i.e., the previous block is not done, so we can't get any

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1178:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc((long unsigned int)(block_samples * <unknown>))' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1176|   
# 1177|               wps_copy->sample_buffer = malloc (block_samples * (wps->wphdr.flags & MONO_FLAG ? 4 : 8));
# 1178|->             memcpy (wps_copy->sample_buffer, wps->sample_buffer, block_samples * (wps->wphdr.flags & MONO_FLAG ? 4 : 8));
# 1179|   
# 1180|               if (wps->discontinuous && wps->pre_sample_buffer && wps->num_pre_samples) {

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1182:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc((long unsigned int)(*wps.num_pre_samples * <unknown>))' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1180|               if (wps->discontinuous && wps->pre_sample_buffer && wps->num_pre_samples) {
# 1181|                   wps_copy->pre_sample_buffer = malloc (wps->num_pre_samples * (wps->wphdr.flags & MONO_FLAG ? 4 : 8));
# 1182|->                 memcpy (wps_copy->pre_sample_buffer, wps->pre_sample_buffer, wps->num_pre_samples * (wps->wphdr.flags & MONO_FLAG ? 4 : 8));
# 1183|               }
# 1184|               else {

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1191:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc(1024)' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1189|               if (wps->dsd.ptable) {
# 1190|                   wps_copy->dsd.ptable = malloc (256 * sizeof (*wps->dsd.ptable));
# 1191|->                 memcpy (wps_copy->dsd.ptable, wps->dsd.ptable, 256 * sizeof (*wps->dsd.ptable));
# 1192|               }
# 1193|   

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1244:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*wps.pre_sample_buffer' where non-null expected
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:22: included_from: Included from here.
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1822:5: note: in expansion of macro 'wp_mutex_release'
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1242|   
# 1243|               if (wps->wpc->block_samples > wps->wpc->max_pre_samples) {
# 1244|->                 memcpy (wps->pre_sample_buffer,
# 1245|                       wps->sample_buffer + (wps->wpc->block_samples - wps->wpc->max_pre_samples) * (wps->wphdr.flags & MONO_FLAG ? 1 : 2),
# 1246|                       wps->wpc->max_pre_samples * (wps->wphdr.flags & MONO_FLAG ? 4 : 8));

Error: GCC_ANALYZER_WARNING (CWE-688):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1251:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*wps.pre_sample_buffer' where non-null expected
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1822:5: note: in expansion of macro 'wp_mutex_release'
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1249|               }
# 1250|               else {
# 1251|->                 memcpy (wps->pre_sample_buffer, wps->sample_buffer, wps->wpc->block_samples * (wps->wphdr.flags & MONO_FLAG ? 4 : 8));
# 1252|                   wps->num_pre_samples = wps->wpc->block_samples;
# 1253|               }

Error: GCC_ANALYZER_WARNING (CWE-476):
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c: scope_hint: In function 'worker_threads_create'
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1841:36: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL '*wpc.workers'
wavpack-5.7.0-build/wavpack-5.7.0/src/pack_utils.c:1835:9: note: in expansion of macro 'wp_mutex_init'
# 1839|   
# 1840|           for (i = 0; i < wpc->num_workers; ++i) {
# 1841|->             wpc->workers [i].mutex = &wpc->mutex;
# 1842|               wpc->workers [i].global_cond = &wpc->global_cond;
# 1843|               wpc->workers [i].workers_ready = &wpc->workers_ready;

Error: CLANG_WARNING:
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack.c:735:25: warning[core.BitwiseShift]: Left shift overflows the capacity of 'uint32_t'
#  733|                       }
#  734|                       else {
#  735|->                         getbits (&data, sent_bits, &wps->wvxbits);
#  736|                           *dptr = ((uint32_t) *dptr << sent_bits) | (data & mask);
#  737|                       }

Error: CLANG_WARNING:
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_floats.c:93:29: warning[core.BitwiseShift]: Left shift overflows the capacity of 'uint32_t'
#   91|   
#   92|                           if ((shift_count -= num_zeros) > 0) {
#   93|->                             getbits (&temp, shift_count, &wps->wvxbits);
#   94|                               *values |= (temp << num_zeros) & mask;
#   95|                           }

Error: GCC_ANALYZER_WARNING (CWE-476):
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c: scope_hint: In function 'unpack_samples_interleave'
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:68:23: warning[-Wanalyzer-null-dereference]: dereference of NULL 'src'
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:19: included_from: Included from here.
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:504:9: note: in expansion of macro 'wp_mutex_release'
#   66|       if (wps->wphdr.flags & MONO_FLAG) {
#   67|           while (samcnt--) {
#   68|->             dst [0] = *src++;
#   69|               dst += num_channels;
#   70|           }

Error: GCC_ANALYZER_WARNING (CWE-476):
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:77:27: warning[-Wanalyzer-null-dereference]: dereference of NULL 'src'
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:504:9: note: in expansion of macro 'wp_mutex_release'
#   75|       else if (offset == num_channels - 1) {
#   76|           while (samcnt--) {
#   77|->             dst [0] = src [0];
#   78|               dst += num_channels;
#   79|               src += 2;

Error: GCC_ANALYZER_WARNING (CWE-476):
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:87:23: warning[-Wanalyzer-null-dereference]: dereference of NULL 'src'
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:504:9: note: in expansion of macro 'wp_mutex_release'
#   85|       else {
#   86|           while (samcnt--) {
#   87|->             dst [0] = *src++;
#   88|               dst [1] = *src++;
#   89|               dst += num_channels;

Error: CLANG_WARNING:
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:396:33: warning[deadcode.DeadStores]: Although the value stored to 'stream_index' is used in the enclosing expression, the value is never actually read from 'stream_index'
#  394|               // go back to the first stream (we're going to leave them all loaded for now because they might have more samples)
#  395|   
#  396|->             wps = wpc->streams [stream_index = 0];
#  397|           }
#  398|           // catch the error situation where we have only one channel but run into a stereo block

Error: CPPCHECK_WARNING (CWE-401):
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:510: error[memleakOnRealloc]: Common realloc mistake: 'temp_buffer' nulled but not freed upon failure
#  508|   
#  509|           if (cxt->samcnt > temp_samples)             // reallocate temp buffer if not big enough
#  510|->             temp_buffer = (int32_t *) realloc (temp_buffer, (temp_samples = cxt->samcnt) * 8);
#  511|   
#  512|           // this is where the work is done

Error: GCC_ANALYZER_WARNING (CWE-476):
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c: scope_hint: In function 'worker_threads_create'
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:594:36: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL '*wpc.workers'
wavpack-5.7.0-build/wavpack-5.7.0/src/unpack_utils.c:588:9: note: in expansion of macro 'wp_mutex_init'
#  592|   
#  593|           for (i = 0; i < wpc->num_workers; ++i) {
#  594|->             wpc->workers [i].mutex = &wpc->mutex;
#  595|               wpc->workers [i].global_cond = &wpc->global_cond;
#  596|               wpc->workers [i].workers_ready = &wpc->workers_ready;