wasm: check for invalid string in read_form
authorJoel Martin <github@martintribe.org>
Wed, 31 Jul 2019 04:10:44 +0000 (23:10 -0500)
committerJoel Martin <github@martintribe.org>
Wed, 31 Jul 2019 04:14:16 +0000 (23:14 -0500)
wasm/reader.wam

index 6e3e8f9..ec2184c 100644 (file)
@@ -91,7 +91,7 @@
       (else
         ;;; if (c == '"') isstring = true
         (local.set $isstring (i32.eq $c (CHR "\"")))
-        (local.set $instring 1)
+        (local.set $instring $isstring)
         (block $done
           (loop $loop
             ;; peek at next character
     (if (global.get $error_type) (return 0))
 
     (local.set $tok ($read_token $str))
+
+    (if (global.get $error_type) (return 0))
     ;;($printf_1 ">>> read_form 1: %s\n" $tok)
     ;;; c0 = token[0]
     (local.set $c0 (i32.load8_u $tok))