Socket Repl Crashes the app when provided with "\'asdf" string including quotes

Description

user=> "\'asdf"
InvalidOperationException Unsupported escape character: \' clojure.lang.LispReader+StringReader.Read (:0)
CompilerException System.InvalidOperationException: Unable to resolve symbol: asdf in this context
at clojure.lang.Compiler.ResolveIn(Namespace n, Symbol symbol, Boolean allowPrivate)
at clojure.lang.Compiler.AnalyzeSymbol(Symbol symbol)
at clojure.lang.Compiler.Analyze(ParserContext pcontext, Object form, String name), compiling: (NO_SOURCE_PATH:0:0)

Possible solution would be to put a Try Catch inside loop,

(try (print (eval (read)))
(catch Exception e (print e)))

Environment

None

Activity

Show:
David Miller
April 1, 2018, 11:49 PM

This is not an error.
It is exactly the same behavior as ClojureJVM.
\ is allowed inside of strings in order to escape certain characters.
Allowed to follow \ are one of: trn\"bfu
\u must be followed by a base 16 representation for a Unicode character.
Otherwise, \ can be followed by octal digits.

Because the reader blows after "\' it next tries to read the characters "asdf", which it interprets as a symbol and then eval, leading to the second exception.

Declined

Assignee

David Miller

Reporter

import