Fix more issues found by address sanitizer

This commit is contained in:
Damiano Galassi committed 2015-08-20 15:28:48 +02:00
1 parent 9e3554d6df
commit 7612b74435
4 files changed
+13 -8

No files matched your search

+1
View File
@@ -19,6 +19,7 @@ typedef enum MP42TagArtworkType_e {
} MP42TagArtworkType;
@interface MP42Image : NSObject <NSCoding, NSCopying> {
@private
NSImage *_image;
NSURL *_url;
+4 -4
View File
@@ -1079,8 +1079,8 @@ static const genreType_t genreType_strings[] = {
if ([tagsDict valueForKey:@"Track #"]) {
MP4TagTrack dtrack; int trackNum = 0, totalTrackNum = 0;
char separator;
sscanf([[tagsDict valueForKey:@"Track #"] UTF8String],"%u%[/- ]%u", &trackNum, &separator, &totalTrackNum);
char separator[3];
sscanf([[tagsDict valueForKey:@"Track #"] UTF8String],"%u%[/- ]%u", &trackNum, separator, &totalTrackNum);
dtrack.index = trackNum;
dtrack.total = totalTrackNum;
MP4TagsSetTrack(tags, &dtrack);
@@ -1090,8 +1090,8 @@ static const genreType_t genreType_strings[] = {
if ([tagsDict valueForKey:@"Disk #"]) {
MP4TagDisk ddisk; int diskNum = 0, totalDiskNum = 0;
char separator;
sscanf([[tagsDict valueForKey:@"Disk #"] UTF8String],"%u%[/- ]%u", &diskNum, &separator, &totalDiskNum);
char separator[3];
sscanf([[tagsDict valueForKey:@"Disk #"] UTF8String],"%u%[/- ]%u", &diskNum, separator, &totalDiskNum);
ddisk.index = diskNum;
ddisk.total = totalDiskNum;
MP4TagsSetDisk(tags, &ddisk);
+7 -4
View File
@@ -110,8 +110,10 @@
// H.264 video track
if ([track isMemberOfClass:[MP42VideoTrack class]] && [track.format isEqualToString:MP42VideoFormatH264]) {
if ([magicCookie length] < sizeof(uint8_t) * 6)
if ([magicCookie length] < sizeof(uint8_t) * 6) {
continue;
}
NSSize size = [helper->importer sizeForTrack:track];
@@ -127,13 +129,14 @@
SInt64 i;
int8_t spsCount = (avcCAtom[5] & 0x1f);
uint8_t ptrPos = 6;
NSUInteger len = magicCookie.length;
for (i = 0; i < spsCount; i++) {
uint16_t spsSize = (avcCAtom[ptrPos++] << 8) & 0xff00;
spsSize += avcCAtom[ptrPos++] & 0xff;
if (spsSize + ptrPos < magicCookie.length) {
if (ptrPos + spsSize <= len) {
MP4AddH264SequenceParameterSet(_fileHandle, dstTrackId,
avcCAtom+ptrPos, spsSize);
avcCAtom + ptrPos, spsSize);
ptrPos += spsSize;
} else {
break;
@@ -145,7 +148,7 @@
uint16_t ppsSize = (avcCAtom[ptrPos++] << 8) & 0xff00;
ppsSize += avcCAtom[ptrPos++] & 0xff;
if (ppsSize + ptrPos < magicCookie.length) {
if (ptrPos + ppsSize <= len) {
MP4AddH264PictureParameterSet(_fileHandle, dstTrackId,
avcCAtom + ptrPos, ppsSize);
ptrPos += ppsSize;
+1
View File
@@ -13,6 +13,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface MP42TextSample : NSObject <NSCoding> {
@private
MP42Duration _timestamp;
MP42Image *_image;
NSString *_title;