This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit ba8604f8be37637f8fab574ddc8ba6b9e459f9dc Author: Kacper Michajłow <[email protected]> AuthorDate: Tue Sep 22 18:34:18 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Tue Sep 29 22:39:09 2026 +0200 avutil/tests/utf8: decode built-in sequences when no file is given The test required an input file and FATE has no stable one to feed it. Cover valid, overlong, surrogate, non-character, out-of-range, truncated and stray-continuation cases from a built-in table instead. Signed-off-by: Kacper Michajłow <[email protected]> --- libavutil/tests/utf8.c | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/libavutil/tests/utf8.c b/libavutil/tests/utf8.c index 37a2802b5f..6046c8cc71 100644 --- a/libavutil/tests/utf8.c +++ b/libavutil/tests/utf8.c @@ -23,6 +23,23 @@ #include "libavutil/avstring.h" #include "libavutil/file.h" +static const uint8_t vectors[] = + "A\n" + "\xC3\xA9\n" /* U+00E9 */ + "\xE2\x82\xAC\n" /* U+20AC */ + "\xF0\x9F\x98\x80\n" /* U+1F600 */ + "\xF4\x8F\xBF\xBF\n" /* U+10FFFF */ + "\xF4\x90\x80\x80\n" /* U+110000 */ + "\xF8\x88\x80\x80\x80\n" /* 5 byte form of U+200000 */ + "\xC0\x80\n" /* overlong NUL */ + "\xE0\x80\x80\n" /* overlong NUL */ + "\xED\xA0\x80\n" /* U+D800 surrogate */ + "\xEF\xBF\xBF\n" /* U+FFFF */ + "\x80\n" /* stray continuation */ + "\xFE\n" /* invalid lead byte */ + "\xC3" "A\n" /* missing continuation */ + "\xE2\x82"; /* truncated */ + static void print_sequence(const char *p, int l, int indent) { int i; @@ -31,21 +48,10 @@ static void print_sequence(const char *p, int l, int indent) printf("%*s", indent-l*2, ""); } -int main(int argc, char **argv) +static void decode(const uint8_t *p, const uint8_t *endp) { - int ret; - char *filename = argv[1]; - uint8_t *file_buf; - size_t file_buf_size; uint32_t code; - const uint8_t *p, *endp; - ret = av_file_map(filename, &file_buf, &file_buf_size, 0, NULL); - if (ret < 0) - return 1; - - p = file_buf; - endp = file_buf + file_buf_size; while (p < endp) { int l, r; const uint8_t *p0 = p; @@ -65,7 +71,21 @@ int main(int argc, char **argv) printf("invalid sequence\n"); } } +} + +int main(int argc, char **argv) +{ + if (argc > 1) { + uint8_t *file_buf; + size_t file_buf_size; + int ret = av_file_map(argv[1], &file_buf, &file_buf_size, 0, NULL); + if (ret < 0) + return 1; + decode(file_buf, file_buf + file_buf_size); + av_file_unmap(file_buf, file_buf_size); + } else { + decode(vectors, vectors + sizeof(vectors) - 1); + } - av_file_unmap(file_buf, file_buf_size); return 0; } -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
