mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

when compiling i get: error: null pointer dereference [-Werror=null-dereference] #589

Closed zoff99 closed 1 year ago

zoff99 commented 1 year ago

on ubuntu:18.04 compiling with The C compiler identification is GNU 7.5.0 the following error comes up:

miniaudio.h: In function 'size_t drwav__write_or_count_metadata(drwav, drwav_metadata, drwav_uint32)': miniaudio.h:76321:49: error: null pointer dereference [-Werror=null-dereference] bytesWritten += drwav__write(pWav, pMetadata->data.smpl.pSamplerSpecificData, pMetadata->data.smpl.samplerSpecificDataSizeInBytes);

is this a false positive? or an actual problem?

zoff99 commented 1 year ago

on docker.io/library/debian:stable with The C compiler identification is GNU 10.2.1

miniaudio.h: In function 'size_t drwav__write_or_count_metadata(drwav, drwav_metadata, drwav_uint32)': miniaudio.h:76169:18: error: null pointer dereference [-Werror=null-dereference] 76169 | return pWav->onWrite(pWav->pUserData, pData, dataSize); | ~~^~~ miniaudio.h:76169:25: error: null pointer dereference [-Werror=null-dereference] 76169 | return pWav->onWrite(pWav->pUserData, pData, dataSize); | ~~~^~~~~~~~

mackron commented 1 year ago

Thanks for the report. This was coming from dr_wav. I've pushed a potential fix to the dev branch. Are you able to try the dev branch and verify that fix?

zoff99 commented 1 year ago

yes the dev branch version fixes the errors.

mackron commented 1 year ago

Thanks for checking that. This will be in the next release.