Comments (9)
I've updated the master branch with this change. Version 0.6.37.
from dr_libs.
Thanks. This is a weird one because there are literal asserts in there to account for this like you mentioned. It feels like for some reason the compilers are not recognizing those asserts:
DRMP3_ASSERT(pMP3->pData != NULL);
DRMP3_ASSERT(pMP3->dataCapacity > 0);
pcmFramesRead = drmp3dec_decode_frame(&pMP3->decoder, pMP3->pData + pMP3->dataConsumed, (int)pMP3->dataSize, pPCMFrames, &info); /* <-- Safe size_t -> int conversion thanks to the check above. */
I'm almost wondering if maybe I just do a normal run-time check for pData
being null and just returning 0. Have you by chance tried that to see if it cleans up that warning? I don't like the idea of modifying drmp3dec_decode_frame()
simply because that code is from minimp3 which I'm not fully intimate with.
I'm not really the biggest fan of the nonnull
thing because it just feels a bit hacky, and I'd be nice to avoid compiler-specific stuff if possible. But that said, if I need to do a compiler-specific thing so be it.
from dr_libs.
I tried what you said and naively returned 0. This seems to silence the error.
It also complains about this move operation. https://github.com/mackron/dr_libs/blob/master/dr_mp3.h#L2725
from dr_libs.
I've pushed a potential fix to clean up this warning to the dev branch. Are you able to try that?
from dr_libs.
That seems to have fixed it.
from dr_libs.
OK, that's good to hear. The fact that the static analyzer is recognizing the runtime check indicates to me that it's not detecting or recognizing the assert for some reason. In any case I'll get this released shortly.
from dr_libs.
Could be due to NDEBUG
from dr_libs.
I've updated dr_wav.h and theres this new one that popped up.
warning: Array access (from variable 'pBufferOut') results in a null pointer dereference [clang-analyzer-core.NullDereference]
((drwav_uint8*)pBufferOut)[iSample] += 128;
^
Additional context
src/Audio/WavAudioDecoder.cpp:31: Calling 'drwav_read_pcm_frames_s16'
[[maybe_unused]] auto framesRead = drwav_read_pcm_frames_s16(&_wav, frameCount, buffer.data());
^
externals/dr_libs/dr_wav.h:6788: 'pWav' is not equal to NULL
if (pWav == NULL || framesToRead == 0) {
^
externals/dr_libs/dr_wav.h:6788: Left side of '||' is false
if (pWav == NULL || framesToRead == 0) {
^
externals/dr_libs/dr_wav.h:6788: Assuming 'framesToRead' is not equal to 0
if (pWav == NULL || framesToRead == 0) {
^
externals/dr_libs/dr_wav.h:6788: Taking false branch
if (pWav == NULL || framesToRead == 0) {
^
externals/dr_libs/dr_wav.h:6792: Assuming 'pBufferOut' is equal to NULL
if (pBufferOut == NULL) {
^
externals/dr_libs/dr_wav.h:6792: Taking true branch
if (pBufferOut == NULL) {
^
externals/dr_libs/dr_wav.h:6793: Passing null pointer value via 3rd parameter 'pBufferOut'
return drwav_read_pcm_frames(pWav, framesToRead, NULL);
^
/usr/lib/llvm-15/lib/clang/15.0.7/include/stddef.h:83: expanded from macro 'NULL'
# define NULL __null
^
externals/dr_libs/dr_wav.h:6793: Calling 'drwav_read_pcm_frames'
return drwav_read_pcm_frames(pWav, framesToRead, NULL);
^
externals/dr_libs/dr_wav.h:5757: Taking false branch
if (drwav_is_container_be(pWav->container)) {
^
externals/dr_libs/dr_wav.h:5775: Taking true branch
if (drwav__is_little_endian()) {
^
externals/dr_libs/dr_wav.h:5787: Assuming field 'container' is equal to drwav_container_aiff
if (pWav->container == drwav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == DRWAV_FALSE) {
^
externals/dr_libs/dr_wav.h:5787: Left side of '&&' is true
if (pWav->container == drwav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == DRWAV_FALSE) {
^
externals/dr_libs/dr_wav.h:5787: Assuming field 'bitsPerSample' is equal to 8
if (pWav->container == drwav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == DRWAV_FALSE) {
^
externals/dr_libs/dr_wav.h:5787: Left side of '&&' is true
if (pWav->container == drwav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == DRWAV_FALSE) {
^
externals/dr_libs/dr_wav.h:5787: Assuming field 'isUnsigned' is equal to DRWAV_FALSE
if (pWav->container == drwav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == DRWAV_FALSE) {
^
externals/dr_libs/dr_wav.h:5787: Taking true branch
if (pWav->container == drwav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == DRWAV_FALSE) {
^
externals/dr_libs/dr_wav.h:5790: Assuming the condition is true
for (iSample = 0; iSample < framesRead * pWav->channels; iSample += 1) {
^
externals/dr_libs/dr_wav.h:5790: Loop condition is true. Entering loop body
for (iSample = 0; iSample < framesRead * pWav->channels; iSample += 1) {
^
externals/dr_libs/dr_wav.h:5791: Array access (from variable 'pBufferOut') results in a null pointer dereference
((drwav_uint8*)pBufferOut)[iSample] += 128;
^
from dr_libs.
Thanks. That's a genuine bug. I've gone ahead and fixed that in the dev branch.
from dr_libs.
Related Issues (20)
- dr_flac: crashing on Nintendo 3DS HOT 10
- How to use this on Android NDK? HOT 2
- dr_wav bext is before fmt HOT 2
- How to update wav size info when I generating a wav file? HOT 2
- SIGSEGV when reading WAV metadata HOT 6
- DSD support HOT 1
- Support for streaming use-cases (i.e. write files without making a copy of the raw samples) HOT 2
- Make results consistent when trying to seek beyond the end of sounds.
- dr_wav 0.13.8 fails to load a .wav (invalid data) HOT 4
- dr_mp3 crash if the invalid file is loaded and uninit is called HOT 3
- dr_mp3: Remove customization of output channels and sample rate. HOT 1
- test dr_wav_playback hardcodes miniaudio include path, intended? HOT 1
- Cannot decode very short mp3 file HOT 2
- Make it compile on Cortex M0 (Raspberry Pico) HOT 6
- Suggestion for a MIDI synthesis library HOT 4
- LAME tags are not parsed, leading to an incorrect length calculation HOT 1
- dr_wav: Distortion on output after seeking
- Unable to play AIFF files when SSND chunk comes before COMM
- WAV loop and cue positions are not byte offsets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dr_libs.