Fixing some undefined behaviour, Issue 2277

This commit is contained in:
Ingo
2014-03-11 11:49:06 +01:00
parent 64562bd83f
commit aeeaf4de3c
14 changed files with 55 additions and 34 deletions

View File

@@ -629,6 +629,7 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
tag = get2 (f, order);
type = (TagType)get2 (f, order);
count = get4 (f, order);
if (!count) count = 1;
makerNoteKind = NOMK;
keep = false;
@@ -867,8 +868,9 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
}
else {
// read value
value = new unsigned char [valuesize];
value = new unsigned char [valuesize+1];
fread (value, 1, valuesize, f);
value[valuesize] = '\0';
}
// seek back to the saved position
fseek (f, save, SEEK_SET);