[deserialize] Some more

This commit is contained in:
Behdad Esfahbod 2023-01-25 14:16:46 -07:00
parent 57ff696430
commit b44ff062e1
5 changed files with 33 additions and 5 deletions

View File

@ -322,7 +322,7 @@ _hb_buffer_deserialize_text_glyphs (hb_buffer_t *buffer,
const char **end_ptr, const char **end_ptr,
hb_font_t *font) hb_font_t *font)
{ {
const char *p = buf, *pe = buf + buf_len, *eof = pe; const char *p = buf, *pe = buf + buf_len, *eof = pe, *orig_pe = pe;
/* Ensure we have positions. */ /* Ensure we have positions. */
(void) hb_buffer_get_glyph_positions (buffer, nullptr); (void) hb_buffer_get_glyph_positions (buffer, nullptr);
@ -677,6 +677,13 @@ _again:
#line 136 "hb-buffer-deserialize-text-glyphs.rl" #line 136 "hb-buffer-deserialize-text-glyphs.rl"
if (pe < orig_pe && *pe == ']')
{
pe++;
if (p == pe)
p++;
}
*end_ptr = p; *end_ptr = p;
return p == pe; return p == pe;

View File

@ -104,7 +104,7 @@ _hb_buffer_deserialize_text_glyphs (hb_buffer_t *buffer,
const char **end_ptr, const char **end_ptr,
hb_font_t *font) hb_font_t *font)
{ {
const char *p = buf, *pe = buf + buf_len, *eof = pe; const char *p = buf, *pe = buf + buf_len, *eof = pe, *orig_pe = pe;
/* Ensure we have positions. */ /* Ensure we have positions. */
(void) hb_buffer_get_glyph_positions (buffer, nullptr); (void) hb_buffer_get_glyph_positions (buffer, nullptr);
@ -135,6 +135,13 @@ _hb_buffer_deserialize_text_glyphs (hb_buffer_t *buffer,
write exec; write exec;
}%% }%%
if (pe < orig_pe && *pe == ']')
{
pe++;
if (p == pe)
p++;
}
*end_ptr = p; *end_ptr = p;
return p == pe; return p == pe;

View File

@ -172,7 +172,7 @@ _hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
const char **end_ptr, const char **end_ptr,
hb_font_t *font) hb_font_t *font)
{ {
const char *p = buf, *pe = buf + buf_len, *eof = pe; const char *p = buf, *pe = buf + buf_len, *eof = pe, *orig_pe = pe;
while (p < pe && ISSPACE (*p)) while (p < pe && ISSPACE (*p))
p++; p++;
@ -317,6 +317,13 @@ _again:
#line 115 "hb-buffer-deserialize-text-unicode.rl" #line 115 "hb-buffer-deserialize-text-unicode.rl"
if (pe < orig_pe && *pe == '>')
{
pe++;
if (p == pe)
p++;
}
*end_ptr = p; *end_ptr = p;
return p == pe; return p == pe;

View File

@ -85,7 +85,7 @@ _hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
const char **end_ptr, const char **end_ptr,
hb_font_t *font) hb_font_t *font)
{ {
const char *p = buf, *pe = buf + buf_len, *eof = pe; const char *p = buf, *pe = buf + buf_len, *eof = pe, *orig_pe = pe;
while (p < pe && ISSPACE (*p)) while (p < pe && ISSPACE (*p))
p++; p++;
@ -114,6 +114,13 @@ _hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
write exec; write exec;
}%% }%%
if (pe < orig_pe && *pe == '>')
{
pe++;
if (p == pe)
p++;
}
*end_ptr = p; *end_ptr = p;
return p == pe; return p == pe;

View File

@ -77,7 +77,7 @@ main (int argc, char **argv)
break; break;
} }
if (*p == ']' || *p == '\n') if (*p == '\n')
break; break;
if (p == line) if (p == line)
{ {