Skip to content

Commit

Permalink
sync dr_mp3 with mainstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Dec 2, 2023
1 parent 995af0f commit 5bfdc5e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/dr_mp3.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_mp3 - v0.6.36 - 2023-06-17
dr_mp3 - v0.6.38 - 2023-11-02
David Reid - [email protected]
Expand Down Expand Up @@ -101,7 +101,7 @@ extern "C" {

#define DRMP3_VERSION_MAJOR 0
#define DRMP3_VERSION_MINOR 6
#define DRMP3_VERSION_REVISION 36
#define DRMP3_VERSION_REVISION 38
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)

#include <stddef.h> /* For size_t. */
Expand Down Expand Up @@ -730,7 +730,7 @@ static int drmp3_have_simd(void)

#endif

#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64)
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(__ARM_ARCH_6M__)
#define DRMP3_HAVE_ARMV6 1
static __inline__ __attribute__((always_inline)) drmp3_int32 drmp3_clip_int16_arm(drmp3_int32 a)
{
Expand Down Expand Up @@ -2719,6 +2719,11 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa
DRMP3_ASSERT(pMP3->pData != NULL);
DRMP3_ASSERT(pMP3->dataCapacity > 0);

/* Do a runtime check here to try silencing a false-positive from clang-analyzer. */
if (pMP3->pData == NULL) {
return 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. */

/* Consume the data. */
Expand Down Expand Up @@ -4517,6 +4522,12 @@ counts rather than sample counts.
/*
REVISION HISTORY
================
v0.6.38 - 2023-11-02
- Fix build for ARMv6-M.
v0.6.37 - 2023-07-07
- Silence a static analysis warning.
v0.6.36 - 2023-06-17
- Fix an incorrect date in revision history. No functional change.
Expand Down

0 comments on commit 5bfdc5e

Please sign in to comment.