[test-suite] r247029 - Fix the undefined behavior in MiBench
Steven Wu via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 10:27:48 PDT 2015
Author: steven_wu
Date: Tue Sep 8 12:27:48 2015
New Revision: 247029
URL: http://llvm.org/viewvc/llvm-project?rev=247029&view=rev
Log:
Fix the undefined behavior in MiBench
consumer-lame and consumer-typeset are broken after r246877.
Fix consumer-lane by replacing strcpy with direct assignment to avoid
buffer overflow. consumer-typeset is intentionally overflowing buffer so
FORTIFY_SOURCE is turned off for the benchmark.
Modified:
test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c
test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile
Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c?rev=247029&r1=247028&r2=247029&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c Tue Sep 8 12:27:48 2015
@@ -34,7 +34,7 @@ void id3_inittag(ID3TAGDATA *tag) {
strcpy( tag->album, "");
strcpy( tag->year, "");
strcpy( tag->comment, "");
- strcpy( tag->genre, "ÿ"); /* unset genre */
+ tag->genre[0] = 'ÿ'; /* unset genre */
tag->track = 0;
tag->valid = 0; /* not ready for writing*/
Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile?rev=247029&r1=247028&r2=247029&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile Tue Sep 8 12:27:48 2015
@@ -1,7 +1,9 @@
LEVEL = ../../../..
PROG = consumer-typeset
-CPPFLAGS = -DOS_UNIX=1 -DOS_DOS=0 -DOS_MAC=0 -DDB_FIX=0 -DUSE_STAT=1 -DSAFE_DFT=0 -DCOLLATE=1 -DLIB_DIR=\"lout.lib\" -DFONT_DIR=\"font\" -DMAPS_DIR=\"maps\" -DINCL_DIR=\"include\" -DDATA_DIR=\"data\" -DHYPH_DIR=\"hyph\" -DLOCALE_DIR=\"locale\" -DCHAR_IN=1 -DCHAR_OUT=0 -DLOCALE_ON=1 -DASSERT_ON=1 -DDEBUG_ON=0 -DPDF_COMPRESSION=0
+# FORTIFY_SOURCE is turned off for this benchmark because the type lies at some
+# point in this program and FORIFY implementations rely on the correct type.
+CPPFLAGS = -DOS_UNIX=1 -DOS_DOS=0 -DOS_MAC=0 -DDB_FIX=0 -DUSE_STAT=1 -DSAFE_DFT=0 -DCOLLATE=1 -DLIB_DIR=\"lout.lib\" -DFONT_DIR=\"font\" -DMAPS_DIR=\"maps\" -DINCL_DIR=\"include\" -DDATA_DIR=\"data\" -DHYPH_DIR=\"hyph\" -DLOCALE_DIR=\"locale\" -DCHAR_IN=1 -DCHAR_OUT=0 -DLOCALE_ON=1 -DASSERT_ON=1 -DDEBUG_ON=0 -DPDF_COMPRESSION=0 -D_FORTIFY_SOURCE=0
LDFLAGS = -lm
RUN_OPTIONS = -x -I $(PROJ_SRC_DIR)/data/include -D $(PROJ_SRC_DIR)/data/data -F $(PROJ_SRC_DIR)/data/font -C $(PROJ_SRC_DIR)/data/maps -H $(PROJ_OBJ_DIR)/data/hyph $(PROJ_SRC_DIR)/large.lout
More information about the llvm-commits
mailing list