-rw-r--r-- | libopie2/opiemm/opieexif.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libopie2/opiemm/opieexif.cpp b/libopie2/opiemm/opieexif.cpp index de49937..653216c 100644 --- a/libopie2/opiemm/opieexif.cpp +++ b/libopie2/opiemm/opieexif.cpp @@ -202,13 +202,13 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) case M_SOS: // stop before hitting compressed data // If reading entire image is requested, read the rest of the data. if (ReadMode & READ_IMAGE){ unsigned long size; - size = QMAX( 0ul, infile.size()-infile.at() ); + size = infile.size()-infile.at(); Data = (uchar *)malloc(size); if (Data == NULL){ return false; } got = infile.readBlock((char*)Data, size); @@ -806,13 +806,17 @@ ExifData::~ExifData() //-------------------------------------------------------------------------- bool ExifData::scan(const QString & path) { int ret; QFile f(path); - f.open(IO_ReadOnly); + if ( !f.open(IO_ReadOnly) ) { + owarn << "Unable to open file " << f.name() << " readonly" << oendl; + DiscardData(); + return false; + } // Scan the JPEG headers. ret = ReadJpegSections(f, READ_EXIF); if (ret == false){ owarn << "Not JPEG file!" << oendl; |