Skip to content

Commit d2979ee

Browse files
committed
Signal error for malformed #b/#o/#x/#r reader macros
Without this, #b/#o/#x/#r reader macros bomb out in Java making for a substandard user experience.
1 parent bd1072f commit d2979ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/org/armedbear/lisp/Stream.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,9 @@ public LispObject readRadix(int radix, ReadtableAccessor rta) {
15141514
String s = sb.toString();
15151515
if (s.indexOf('/') >= 0)
15161516
return makeRatio(s, radix);
1517+
if (s.length() == 0) {
1518+
return error(new ReaderError("Malformed number in a #b/#o/#x/#r macro."));
1519+
}
15171520
// Integer.parseInt() below handles a prefixed '-' character correctly, but
15181521
// does not accept a prefixed '+' character, so we skip over it here
15191522
if (s.charAt(0) == '+')

0 commit comments

Comments
 (0)