From 1c030b6eeb41bfebe15e56f77a8bf5176c22d4b4 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Mon, 25 Feb 2013 21:45:13 -0800 Subject: [PATCH] explain some magic number nonsense --- src/jsx_decoder.erl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jsx_decoder.erl b/src/jsx_decoder.erl index cb03b0c..fc5342d 100644 --- a/src/jsx_decoder.erl +++ b/src/jsx_decoder.erl @@ -562,6 +562,9 @@ partial_utf(_) -> false. %% strips continuation bytes after bad utf bytes, guards against both too short %% and overlong sequences. N is the maximum number of bytes to strip +%% if end of input is reached before stripping the max number of continuations +%% possible magic numbers are reinserted into the stream that get us back to +%% the same state without complicated machinery strip_continuations(Rest, Handler, Acc, Stack, Config, 0) -> string(Rest, Handler, ?acc_seq(Acc, 16#fffd), Stack, Config); strip_continuations(<>, Handler, Acc, Stack, Config, N) when X >= 128, X =< 191 ->