summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2019-01-08 18:02:00 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2019-01-08 18:02:00 +0000
commitab5d045fa8811a9d191c40bcbff996dfca8a2e32 (patch)
treea5ad2666d0461729296dff122378e4ebb653adb8
parent8981c9336bd73b0fabe65f449ccbe5fb808bebdd (diff)
downloadmdk-ab5d045fa8811a9d191c40bcbff996dfca8a2e32.tar.gz
mdk-ab5d045fa8811a9d191c40bcbff996dfca8a2e32.tar.bz2
Fix for mixasm infinite loop on invalid F-specs (bug #32452)
Thanks to Sascha Wilde.
-rw-r--r--mixlib/mix_scanner.l8
-rw-r--r--samples/Makefile.am2
-rw-r--r--samples/tests/Makefile.am4
-rw-r--r--samples/tests/dup_f.mixal3
-rw-r--r--samples/tests/minus_zero.mixal (renamed from samples/minus_zero.mixal)0
5 files changed, 13 insertions, 4 deletions
diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l
index 9071847..0ad1990 100644
--- a/mixlib/mix_scanner.l
+++ b/mixlib/mix_scanner.l
@@ -481,9 +481,15 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
ADD_INS ();
}
}
- {expr}/")" {
+
+ {expr}/")"(({ws}+.*\n)|\n) {
ENTER_EVAL ();
}
+
+ {expr}")".+ {
+ RETURN_ERROR (MIX_PERR_INV_FSPEC, g_strdup_printf ("(%s", yytext));
+ }
+
. RETURN_ERROR (MIX_PERR_INV_FSPEC, yytext);
}
diff --git a/samples/Makefile.am b/samples/Makefile.am
index c1dcfa6..b3dcf28 100644
--- a/samples/Makefile.am
+++ b/samples/Makefile.am
@@ -14,4 +14,4 @@ SUBDIRS = tests
EXTRA_DIST = primes.result hello.mixal primes.mixal echo.mixal \
permutations.mixal permutations.cardrd isains.mixal \
- elevator.mixal mystery.mixal minus_zero.mixal
+ elevator.mixal mystery.mixal
diff --git a/samples/tests/Makefile.am b/samples/tests/Makefile.am
index b75454c..6c15e64 100644
--- a/samples/tests/Makefile.am
+++ b/samples/tests/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-# Copyright (C) 2006 by Free Software Foundation, Inc.
+# Copyright (C) 2006, 2019 by Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
@@ -12,6 +12,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EXTRA_DIST = bt.mixal cbp.mixal ldan.mixal lockonw.mixal negwrite.mixal \
+ minus_zero.mixal dup_f.mixal \
stress0.mixal stress1.mixal stress2.mixal stress4.mixal \
stress5.mixal stress6.mixal
-
diff --git a/samples/tests/dup_f.mixal b/samples/tests/dup_f.mixal
new file mode 100644
index 0000000..63abc7c
--- /dev/null
+++ b/samples/tests/dup_f.mixal
@@ -0,0 +1,3 @@
+START LDA 1(4:4),1(5:5)
+ HLT
+ END START
diff --git a/samples/minus_zero.mixal b/samples/tests/minus_zero.mixal
index 9adb914..9adb914 100644
--- a/samples/minus_zero.mixal
+++ b/samples/tests/minus_zero.mixal