Hi!

Attached patch is supposed to fix ticket #7491, I currently don't have
gcc 8 to test myself.

Please comment, Carl Eugen
From 90ac3c2b931d060e918a66047ff76c7d45f2274a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffm...@gmail.com>
Date: Sun, 14 Oct 2018 22:13:34 +0200
Subject: [PATCH] lavc/sinewin: Do not declare the tables as const.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

At least ff_sine_window_init() is writing to some of the tables causing
a crash if compiled with gcc 8 and lto.

Analyzed by Martin Liška in:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85132

Fixes ticket #7491.
---
 libavcodec/sinewin.h          |   10 ++--------
 libavcodec/sinewin_tablegen.h |    2 +-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h
index 6b97a71..146d4e5 100644
--- a/libavcodec/sinewin.h
+++ b/libavcodec/sinewin.h
@@ -25,18 +25,12 @@
 #include "libavutil/mem.h"
 #include "libavcodec/aac_defines.h"
 
-#if CONFIG_HARDCODED_TABLES
-#   define SINETABLE_CONST const
-#else
-#   define SINETABLE_CONST
-#endif
-
 #ifndef USE_FIXED
 #define USE_FIXED 0
 #endif
 
 #define SINETABLE(size) \
-    SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size]
+    DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size]
 
 /**
  * Generate a sine window.
@@ -62,6 +56,6 @@ extern SINETABLE(2048);
 extern SINETABLE(4096);
 extern SINETABLE(8192);
 
-extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[16];
+extern INTFLOAT * const AAC_RENAME(ff_sine_windows)[16];
 
 #endif /* AVCODEC_SINEWIN_H */
diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h
index 0fa3561..e1f7c4f 100644
--- a/libavcodec/sinewin_tablegen.h
+++ b/libavcodec/sinewin_tablegen.h
@@ -59,7 +59,7 @@ SINETABLE(8192);
 #define SIN_FIX(a) a
 #endif
 
-SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = {
+INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = {
     NULL, NULL, NULL, NULL, NULL, // unused
     AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128),
     AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024),
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to