[vlc-devel] [PATCH] contrib: lame: disable asserts

Thomas Guillem thomas at gllm.fr
Mon Dec 9 17:02:19 CET 2019


As the lame INSTALL says:

"For production use, be sure to compile a "Release" target, with the "maximum
speed" compile option, and #define NDEBUG."

It will fix an assert on psymodel.c:576 that could happen when feeding data
after a flush. There is no possible memory corruption but maybe a read of
invalid data that could trigger an audio glitch. Due to the rarity of this bug
(happening only via chromecast, with some input files and with a lot of seek
requests), I think that such fix is enough.

PS: the contrib WITH_OPTIMIZATION option should be split into OPTIMS and DEBUG.
---
 contrib/src/lame/rules.mak | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/contrib/src/lame/rules.mak b/contrib/src/lame/rules.mak
index 32827a8e69a..ab08e93ba96 100644
--- a/contrib/src/lame/rules.mak
+++ b/contrib/src/lame/rules.mak
@@ -2,12 +2,17 @@
 
 LAME_VERSION := 3.100
 LAME_URL := $(SF)/lame/lame-$(LAME_VERSION).tar.gz
+LAME_CFLAGS := $(CFLAGS)
 
 $(TARBALLS)/lame-$(LAME_VERSION).tar.gz:
 	$(call download_pkg,$(LAME_URL),lame)
 
 .sum-lame: lame-$(LAME_VERSION).tar.gz
 
+ifdef WITH_OPTIMIZATION
+LAME_CFLAGS += -DNDEBUG
+endif
+
 lame: lame-$(LAME_VERSION).tar.gz .sum-lame
 	$(UNPACK)
 	$(APPLY) $(SRC)/lame/lame-forceinline.patch
@@ -23,6 +28,6 @@ endif
 
 .lame: lame
 	$(RECONF)
-	cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-analyzer-hooks --disable-decoder --disable-gtktest --disable-frontend
+	cd $< && $(HOSTVARS) CFLAGS="$(LAME_CFLAGS)" ./configure $(HOSTCONF) --disable-analyzer-hooks --disable-decoder --disable-gtktest --disable-frontend
 	cd $< && $(MAKE) install
 	touch $@
-- 
2.20.1



More information about the vlc-devel mailing list