Skip to content

Commit 34a46de

Browse files
committed
MP3Decoder: Request defined behavior for signed integer shifts
gcc -fsanitize=undefined reports diagnostics like these: ``` ../../src/bitstream.c:93:36: runtime error: left shift of 177 by 24 places cannot be represented in type 'int' ../../src/imdct.c:86:53: runtime error: left shift of negative value -937 ``` -fwrapv provides implementation-defined behavior that matches the expectations of two's complement arithmetic.
1 parent 334287b commit 34a46de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/circuitpy_defns.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ SRC_MOD += $(addprefix lib/mp3/src/, \
782782
subband.c \
783783
trigtabs.c \
784784
)
785-
$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "shared-module/audiomp3/__init__.h" -D'MPDEC_ALLOCATOR(x)=mp3_alloc(x)' -D'MPDEC_FREE(x)=mp3_free(x)'
785+
$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "shared-module/audiomp3/__init__.h" -D'MPDEC_ALLOCATOR(x)=mp3_alloc(x)' -D'MPDEC_FREE(x)=mp3_free(x)' -fwrapv
786786
ifeq ($(CIRCUITPY_AUDIOMP3_USE_PORT_ALLOCATOR),1)
787787
SRC_COMMON_HAL_ALL += \
788788
audiomp3/__init__.c

0 commit comments

Comments
 (0)