Fix some coverity issues
This commit is contained in:
@@ -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,27 +2785,29 @@ 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;
|
if(fread (&c, 1, 1, f) == 1) {
|
||||||
fread (&c, 1, 1, f);
|
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;
|
||||||
|
|
||||||
while (fread (&c, 1, 1, f)) {
|
while (fread (&c, 1, 1, f)) {
|
||||||
if (c != markerl) {
|
if (c != markerl) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread (&c, 1, 1, f) && c == 0xe1) { // APP1 marker found
|
if (fread (&c, 1, 1, f) && c == 0xe1) { // APP1 marker found
|
||||||
if (fread (idbuff, 1, 8, f) < 8) {
|
if (fread (idbuff, 1, 8, f) < 8) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!memcmp (idbuff + 2, exifid, 6)) { // Exif info found
|
if (!memcmp (idbuff + 2, exifid, 6)) { // Exif info found
|
||||||
tiffbase = ftell (f);
|
tiffbase = ftell (f);
|
||||||
return parse (f, tiffbase);
|
return parse (f, tiffbase);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user