File tree Expand file tree Collapse file tree 6 files changed +35
-3
lines changed Expand file tree Collapse file tree 6 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ test-suite aeson-tests
176
176
Regression.Issue571
177
177
Regression.Issue687
178
178
Regression.Issue967
179
+ Regression.Issue1138
179
180
RFC8785
180
181
SerializationFormatSpec
181
182
Types
Original file line number Diff line number Diff line change @@ -153,7 +153,9 @@ scanStringLiteral ok err bs0 = go 0 bs0 where
153
153
Right t -> ok t (BS. drop (n + 1 ) bs0)
154
154
Left e -> err (show e)
155
155
Just (92 , bs') -> goSlash (n + 1 ) bs'
156
- Just (_, bs') -> goEsc (n + 1 ) bs'
156
+ Just (w8, bs')
157
+ | w8 < 0x20 -> errCC
158
+ | otherwise -> goEsc (n + 1 ) bs'
157
159
158
160
goSlash :: Int -> ByteString -> r
159
161
goSlash ! n ! bs = case BS. uncons bs of
Original file line number Diff line number Diff line change @@ -159,7 +159,9 @@ scanStringLiteral ok err bs0 = go 0 bs0 where
159
159
Right t -> ok t (lbsDrop (n + 1 ) bs0)
160
160
Left e -> err (show e)
161
161
Just (92 , bs') -> goSlash (n + 1 ) bs'
162
- Just (_, bs') -> goEsc (n + 1 ) bs'
162
+ Just (w8, bs')
163
+ | w8 < 0x20 -> errCC
164
+ | otherwise -> goEsc (n + 1 ) bs'
163
165
164
166
goSlash :: Int -> ByteString -> r
165
167
goSlash ! n ! bs = case LBS. uncons bs of
Original file line number Diff line number Diff line change @@ -163,7 +163,9 @@ scanStringLiteral ok err bs0 = go 0 bs0 where
163
163
Right t -> ok t (unsafeDropPoints (n + 1 ) bs0)
164
164
Left e -> err (show e)
165
165
Just (92 , bs') -> goSlash (n + 1 ) bs'
166
- Just (_, bs') -> goEsc (n + 1 ) bs'
166
+ Just (w8, bs')
167
+ | w8 < 0x20 -> errCC
168
+ | otherwise -> goEsc (n + 1 ) bs'
167
169
168
170
goSlash :: Int -> Text -> r
169
171
goSlash ! n ! bs = case unconsPoint bs of
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE OverloadedStrings #-}
2
+ module Regression.Issue1138 (issue1138 ) where
3
+
4
+ import Test.Tasty (TestTree , testGroup )
5
+ import Test.Tasty.HUnit (testCase , assertFailure )
6
+
7
+ import Data.Aeson
8
+
9
+ assertDecodeFailure :: Either String Value -> IO ()
10
+ assertDecodeFailure (Right v) = assertFailure $ " Unexpected success: " ++ show v
11
+ assertDecodeFailure (Left _) = return ()
12
+
13
+ issue1138 :: TestTree
14
+ issue1138 = testGroup " Issue #1138" $ map (testCase " -" )
15
+ [ assertDecodeFailure $ eitherDecode " \"\t\" "
16
+ , assertDecodeFailure $ eitherDecode " \"\\\\\t\" "
17
+
18
+ , assertDecodeFailure $ eitherDecodeStrict " \"\t\" "
19
+ , assertDecodeFailure $ eitherDecodeStrict " \"\\\\\t\" "
20
+
21
+ , assertDecodeFailure $ eitherDecodeStrictText " \"\t\" "
22
+ , assertDecodeFailure $ eitherDecodeStrictText " \"\\\\\t\" "
23
+ ]
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ import Regression.Issue351
64
64
import Regression.Issue571
65
65
import Regression.Issue687
66
66
import Regression.Issue967
67
+ import Regression.Issue1138
67
68
import UnitTests.OmitNothingFieldsNote
68
69
import UnitTests.FromJSONKey
69
70
import UnitTests.Hashable
@@ -568,6 +569,7 @@ tests = testGroup "unit" [
568
569
, issue571
569
570
, issue687
570
571
, issue967
572
+ , issue1138
571
573
, keyMapInsertWithTests
572
574
, omitNothingFieldsNoteTests
573
575
, noThunksTests
You can’t perform that action at this time.
0 commit comments