Skip to content

Commit 4c13608

Browse files
committed
check error code on call to gf_utf8_wcstombs (#1177)
1 parent 4e318a2 commit 4c13608

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: src/media_tools/text_import.c

+2
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicod
269269
}
270270
sptr = (u16 *)szLine;
271271
i = (u32) gf_utf8_wcstombs(szLineConv, 1024, (const unsigned short **) &sptr);
272+
if (i >= (u32)ARRAY_LENGTH(szLineConv))
273+
return NULL;
272274
szLineConv[i] = 0;
273275
strcpy(szLine, szLineConv);
274276
/*this is ugly indeed: since input is UTF16-LE, there are many chances the fgets never reads the \0 after a \n*/

0 commit comments

Comments
 (0)