API: accept const char* in all args taking strings
This also involves a substantial refactor of string handling in ass.c
and in the parse functions in ass_utils.c:
- Most strings are now passed around internally via ASS_StringView
- Our own read_digits routine is now used in several cases where we previously used atoi/strtoll
- This is more vsfilter-compatible; vsfilter uses the same int parsing for all integer fields, color or not
- A number of cases where we were case-sensitive are now case-insensitive, matching vsfilter
- ass_process_data now buffers incomplete lines
The preceding commit 729e48a1eb90bd56b4bb670ee9c8c3821ef12c45
introduced the possibility of UB, when one of the following is true:
- the namelen calculation of the first path overflows to exactly zero
resulting in a NULL namebuf being passed to ass_msg and read_file
- size_t gets promoted to int and the namelen calculation
results in a signed integer overflow
To fix the former we check the namelen calculation for
wrap-arounds and skip such overly long paths.
To fix the latter we specify the constant as an unsigned integer
ensuring type promotion will be done to the larger type between
size_t and unsigned, but never to signed int.
Thanks to Oleg Oshmyan for noticing and helping to fix this.
ass_face_stream: don't leak first struct if second alloc fails
Bug in commit a7f67df5f96f03fab6661d90d716c16e0fab4a21, which introduced
the alloc check. Before that, alloc failure would result in illegal
memory access, so at least this was an improvement.