From a87dd6095ce6a12b2d60439d16ba02b81cf6e0ef Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Fri, 1 Nov 2013 12:15:12 +0100 Subject: [PATCH] src/file_pdf.c: check ftell returned value for error code --- src/file_pdf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/file_pdf.c b/src/file_pdf.c index 072a8802..58c6136d 100644 --- a/src/file_pdf.c +++ b/src/file_pdf.c @@ -92,6 +92,11 @@ static void file_rename_pdf(const char *old_filename) return; } offset=ftell(handle); + if(offset < 0) + { + fclose(handle); + return; + } offset=file_rsearch(handle, offset, pattern, sizeof(pattern)); if(offset==0) {