Skip to content

Commit

Permalink
RFC requires subset of control characters to be escaped
Browse files Browse the repository at this point in the history
Section 7 of the RFC only requires bytes 00 (NUL) to 1F (US) to be
escaped.

Signed-off-by: onox <[email protected]>
  • Loading branch information
onox committed Aug 18, 2019
1 parent cdd86a1 commit 8bcc2aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/json-tokenizers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.

with Ada.Characters.Handling;
with Ada.Characters.Latin_1;
with Ada.IO_Exceptions;
with Ada.Strings.Bounded;
Expand All @@ -28,6 +27,7 @@ package body JSON.Tokenizers is
Escaped : Boolean := False;

use type Streams.AS.Stream_Element_Offset;
use Ada.Characters.Latin_1;
begin
loop
C := Stream.Read_Character (Index);
Expand All @@ -49,7 +49,7 @@ package body JSON.Tokenizers is
end case;
elsif C /= '\' then
-- Check C is not a control character
if Ada.Characters.Handling.Is_Control (C) then
if C in NUL .. US then
raise Tokenizer_Error with "Unexpected control character in string";
end if;
end if;
Expand Down

0 comments on commit 8bcc2aa

Please sign in to comment.