Fix some coverity issues

This commit is contained in:
heckflosse
2017-06-20 00:00:19 +02:00
parent eeb1135670
commit 240d81d49f

View File

@@ -1085,7 +1085,7 @@ defsubdirs:
// read value // read value
value = new unsigned char [valuesize]; value = new unsigned char [valuesize];
fread (value, 1, valuesize, f); fread (value, 1, valuesize, f);
int pos = ftell (f);
// count the number of valid subdirs // count the number of valid subdirs
int sdcount = count; int sdcount = count;
@@ -1102,7 +1102,6 @@ defsubdirs:
int newpos = base + toInt (j * 4, LONG); int newpos = base + toInt (j * 4, LONG);
fseek (f, newpos, SEEK_SET); fseek (f, newpos, SEEK_SET);
directory[i] = new TagDirectory (parent, f, base, attrib->subdirAttribs, order); directory[i] = new TagDirectory (parent, f, base, attrib->subdirAttribs, order);
fseek (f, pos, SEEK_SET);
} }
// set the terminating NULL // set the terminating NULL
@@ -2741,7 +2740,7 @@ TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored)
Tag* tmodel4 = root->getTag ("LocalizedCameraModel"); Tag* tmodel4 = root->getTag ("LocalizedCameraModel");
if (tmodel4) { if (tmodel4) {
const char *model4 = (tmodel4) ? (const char *)tmodel4->getValue() : ""; const char *model4 = (const char *)tmodel4->getValue();
if (strstr (model4, "Hasselblad ") == model4) { if (strstr (model4, "Hasselblad ") == model4) {
model4 = model4 + 11; model4 = model4 + 11;
@@ -2786,10 +2785,10 @@ TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored)
TagDirectory* ExifManager::parseJPEG (FILE* f, int offset) TagDirectory* ExifManager::parseJPEG (FILE* f, int offset)
{ {
fseek (f, offset, SEEK_SET); if(!fseek (f, offset, SEEK_SET)) {
unsigned char markerl = 0xff;
unsigned char c; unsigned char c;
fread (&c, 1, 1, f); if(fread (&c, 1, 1, f) == 1) {
constexpr unsigned char markerl = 0xff;
const char exifid[] = "Exif\0\0"; const char exifid[] = "Exif\0\0";
char idbuff[8]; char idbuff[8];
int tiffbase = -1; int tiffbase = -1;
@@ -2810,6 +2809,8 @@ TagDirectory* ExifManager::parseJPEG (FILE* f, int offset)
} }
} }
} }
}
}
return nullptr; return nullptr;
} }