bytes = fread (buffer, 1, CHUNKSIZE, s->in);
ogg_sync_wrote (&s->oy, bytes);
- if (!bytes && feof (s->in))
+ if (!bytes && (feof (s->in) || ferror (s->in)))
return 0;
}
do {
/* Bail if we don't find data in the first 40 kB */
- if (feof (s->in) || total >= (CHUNKSIZE * 10)) {
+ if (feof (s->in) || ferror (s->in) || total >= (CHUNKSIZE * 10)) {
ogg_sync_clear (&s->oy);
return VCEDIT_ERR_INVAL;
header = &header_comments;
while (i < 2) {
+ if (feof (s->in) || ferror (s->in)) {
+ ret = VCEDIT_ERR_INVAL;
+ goto err;
+ }
+
while (i < 2) {
int result;
}
buffer = ogg_sync_buffer (&s->oy, CHUNKSIZE);
- bytes = fread (buffer, 1, CHUNKSIZE, s->in);
-
- if (!bytes && feof (s->in) && i < 2) {
- ret = VCEDIT_ERR_INVAL;
- goto err;
- }
+ bytes = fread (buffer, 1, CHUNKSIZE, s->in);
ogg_sync_wrote (&s->oy, bytes);
}
bytes = fread (buffer, 1, CHUNKSIZE, s->in);
ogg_sync_wrote (&s->oy, bytes);
+ if (ferror (s->in))
+ goto cleanup;
+
s->eosin = !bytes && feof (s->in);
} while (!s->eosin);