Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions h3_ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,20 @@ int h3_ffprobe_visual_size(const char *path, int *width, int *height,
path);
return 0;
}
for (char *cursor = output + consumed; *cursor; cursor++) {
if (*cursor != ' ' && *cursor != '\t' && *cursor != '\r' &&
*cursor != '\n') {
fail(error, error_size, "FFprobe returned an invalid visual size");
return 0;
}
/* FFprobe's compact/CSV writer (FFmpeg >= 5.1) emits one item
* separator before an unselected nested stream side_data_list —
* present in e.g. iPhone .mov files carrying a display matrix —
* yielding "3840x2160x". Accept exactly that one optional separator
* before trailing whitespace; anything else is still an error. */
char *cursor = output + consumed;
if (*cursor == 'x') cursor++;
while (*cursor == ' ' || *cursor == '\t' || *cursor == '\r' ||
*cursor == '\n') {
cursor++;
}
if (*cursor != '\0') {
fail(error, error_size, "FFprobe returned an invalid visual size");
return 0;
}
if (parsed_width < 1 || parsed_height < 1) {
fail(error, error_size, "visual stream has invalid dimensions %dx%d",
Expand Down