1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-09-28 22:40:50 +00:00

Parser: Do not parse '&#x;' as byte 0 [#494]

This commit is contained in:
gnosygnu 2019-06-16 15:37:52 -04:00
parent d812b21dec
commit 0cfb0b19ad
2 changed files with 2 additions and 0 deletions

View File

@ -65,6 +65,7 @@ public class Xop_amp_mgr { // TS
// find semic; fail if none found
int semic_pos = Bry_find_.Find_fwd(src, Byte_ascii.Semic, num_bgn, src_len);
if (semic_pos == Bry_find_.Not_found) return rv.Pass_n_(fail_pos);
if (semic_pos == num_bgn) return rv.Pass_n_(fail_pos); // handle "&#x;" where there is no hex/dec number; ISSUE#:494; DATE:2019-06-16
int num_end = semic_pos - 1; // num_end = pos before semicolon
// calc amp_val; EX: Σ -> 931; Σ -> 931;

View File

@ -24,6 +24,7 @@ public class Xop_amp_mgr__decode__tst {
@Test public void Name_fail_amp_only() {fxt.Test__decode_as_bry("a&" , "a&");}
@Test public void Num_fail() {fxt.Test__decode_as_bry("&#!;" , "&#!;");} // ! is not valid num
@Test public void Hex_fail() {fxt.Test__decode_as_bry("&#x!;" , "&#x!;");} // ! is not valid hex
@Test public void Hex_fail_x_only() {fxt.Test__decode_as_bry("&#x;" , "&#x;");} // ISSUE#:494; handle "&#x;"; DATE:2019-06-16
@Test public void Num_basic() {fxt.Test__decode_as_bry("Σ" , "Σ");}
@Test public void Num_zero_padded() {fxt.Test__decode_as_bry("Σ" , "Σ");}
@Test public void Hex_upper() {fxt.Test__decode_as_bry("Σ" , "Σ");}