Skip to content

Commit f685090

Browse files
committed
Skip y4m test on non-seekable input
On a non-seekable input such as a pipe this check skips the first eight bytes which silently corrupts the stream.
1 parent 8321887 commit f685090

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/oapv_app_y4m.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ static int y4m_test(FILE *fp)
4545

4646
char buffer[9] = { 0 };
4747

48+
if (ftell(fp) < 0) {
49+
/* Not seekable, so probably a pipe: assume not-y4m. */
50+
return 0;
51+
}
52+
4853
/*Peek to check if y4m header is present*/
4954
if(!fread(buffer, 1, 8, fp))
5055
return -1;

0 commit comments

Comments
 (0)