Przeglądaj źródła

fix bug on hex escape table

number of items on `hexvals` is 128 while table size is 256, so
remaining 128 items are filled with zero. As a result, values in
\xf0-\xff will be treated as zero while should be rejected.
pull/139/merge
Jihyun Yu 6 lat temu
committed by Paul J. Davis
rodzic
commit
051a74338c
2 zmienionych plików z 18 dodań i 0 usunięć
  1. +17
    -0
      c_src/utf8.c
  2. +1
    -0
      test/jiffy_04_string_tests.erl

+ 17
- 0
c_src/utf8.c Wyświetl plik

@ -19,6 +19,23 @@ static const unsigned char hexvals[256] = {
255, 10, 11, 12, 13, 14, 15, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255
};

+ 1
- 0
test/jiffy_04_string_tests.erl Wyświetl plik

@ -122,6 +122,7 @@ cases(error) ->
<<"\"", 0, "\"">>,
<<"\"\\g\"">>,
<<"\"\\uD834foo\\uDD1E\"">>,
<<"\"\\u", 200, 200, 200, 200, "\"">>,
% CouchDB-345
<<34,78,69,73,77,69,78,32,70,216,82,82,32,70,65,69,78,33,34>>
];

Ładowanie…
Anuluj
Zapisz