Skip to content

Commit

Permalink
added safety utf8 check in text probing
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Jan 18, 2024
1 parent e094485 commit b945f30
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/utf.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ GF_Err gf_utf_get_utf8_string_from_bom(const u8 *data, u32 size, char **out_ptr,
*result = (char *) data;

if (size>=5) {
if (!gf_utf8_is_legal(data+4, size-4))
return GF_IO_ERR;
/*0: no unicode, 1: UTF-16BE, 2: UTF-16LE*/
if ((data[0]==0xFF) && (data[1]==0xFE)) {
if (!data[2] && !data[3]) {
Expand Down

0 comments on commit b945f30

Please sign in to comment.