浏览代码

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/171/head
Jihyun Yu 6 年前
父节点
当前提交
4fe236de36
共有 2 个文件被更改,包括 18 次插入0 次删除
  1. +17
    -0
      c_src/utf8.c
  2. +1
    -0
      test/jiffy_04_string_tests.erl

+ 17
- 0
c_src/utf8.c 查看文件

@ -19,6 +19,23 @@ static const unsigned char hexvals[256] = {
255, 10, 11, 12, 13, 14, 15, 255, 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,
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 查看文件

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

正在加载...
取消
保存