summaryrefslogtreecommitdiffstats
path: root/libhb/hb.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhb/hb.c')
-rw-r--r--libhb/hb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index abcfa72eb..d84fece27 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -696,7 +696,13 @@ hb_buffer_t * hb_read_preview(hb_handle_t * h, hb_title_t *title, int preview)
for (hh = 0; hh < h; hh++)
{
- fread(data, w, 1, file);
+ if (fread(data, w, 1, file) < w)
+ {
+ hb_error( "hb_read_preview: Failed to read line %d from %s" , hh, filename );
+ hb_buffer_close(&buf);
+ break;
+ }
+
data += stride;
}
}