mackron / dr_libs

Audio decoding libraries for C/C++, each in a single source file.
Other
1.24k stars 205 forks source link

dr_wav (dev): Coverity flagged Untrusted loop bound (CWE-606) in `drwav__read_fmt` #219

Closed kcgen closed 2 years ago

kcgen commented 2 years ago

_"An attacker could control the number of times the loop iterates. In drwav__read_fmt, an unscrutinized value from an untrusted source used as a loop bound (CWE-606)"_

2021-12-07_10-02_1

mackron commented 2 years ago

There's nothing to fix here. If the header's size is invalid (i.e. random junk), the seek forward will fail due to it overflowing the size of the file. There's nothing practical to use as a bound check here because a chunk can be any size. Setting this one to wontfix.

kcgen commented 2 years ago

Thanks for the explanation. I've marked it as a false-positive and won'tfix - thanks for the quick assessment @mackron !