Fixed a number of incorrect memory accesses

This commit is contained in:
Damiano Galassi committed 2015-08-20 14:24:44 +02:00
1 parent b06696f299
commit f2ccd9e1d6
6 files changed
+21 -18

No files matched your search

+6 -6
View File
@@ -618,12 +618,12 @@
if (err && AudioChannelLayoutTag_GetNumberOfChannels(channelLayout->mChannelLayoutTag) == 6)
channelBitmap = 0x3F;
uint8_t fscod = 0;
uint8_t bsid = 8;
uint8_t bsmod = 0;
uint8_t acmod = 7;
uint8_t lfeon = (channelBitmap & kAudioChannelBit_LFEScreen) ? 1 : 0;
uint8_t bit_rate_code = 15;
uint64_t fscod = 0;
uint64_t bsid = 8;
uint64_t bsmod = 0;
uint64_t acmod = 7;
uint64_t lfeon = (channelBitmap & kAudioChannelBit_LFEScreen) ? 1 : 0;
uint64_t bit_rate_code = 15;
switch (AudioChannelLayoutTag_GetNumberOfChannels(channelLayout->mChannelLayoutTag) - lfeon) {
case 1:
+1 -1
View File
@@ -235,7 +235,7 @@
}
removeAllChapterTrackReferences(fileHandle);
MP4SetChapters(fileHandle, fileChapters, i, MP4ChapterTypeAny);
MP4SetChapters(fileHandle, fileChapters, i, MP4ChapterTypeQt);
free(fileChapters);
success = _Id = findChapterTrackId(fileHandle);
+2 -2
View File
@@ -491,7 +491,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
return NSMakeSize([(MP42VideoTrack*)track width], [(MP42VideoTrack*) track height]);
}
- (NSData*)magicCookieForTrack:(MP42Track *)track
- (NSData *)magicCookieForTrack:(MP42Track *)track
{
if (!_matroskaFile)
return nil;
@@ -522,7 +522,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
if (readMkvPacket(_ioStream, trackInfo, FilePos, &frame, &FrameSize)) {
// parse AC3 header
// collect all the necessary meta information
uint32_t fscod, frmsizecod, bsid, bsmod, acmod, lfeon;
uint64_t fscod, frmsizecod, bsid, bsmod, acmod, lfeon;
uint32_t lfe_offset = 4;
fscod = (*(frame+4) >> 6) & 0x3;
+2 -2
View File
@@ -115,7 +115,7 @@
NSSize size = [helper->importer sizeForTrack:track];
uint8_t *avcCAtom = (uint8_t*)[magicCookie bytes];
uint8_t *avcCAtom = (uint8_t *)[magicCookie bytes];
dstTrackId = MP4AddH264VideoTrack(_fileHandle, timeScale,
MP4_INVALID_DURATION,
size.width, size.height,
@@ -140,7 +140,7 @@
uint16_t ppsSize = (avcCAtom[ptrPos++] << 8) & 0xff00;
ppsSize += avcCAtom[ptrPos++] & 0xff;
MP4AddH264PictureParameterSet(_fileHandle, dstTrackId,
avcCAtom+ptrPos, ppsSize);
avcCAtom + ptrPos, ppsSize);
ptrPos += ppsSize;
}
+7 -4
View File
@@ -241,7 +241,7 @@ canOutput:
unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign)
{
unsigned hour, minute, second, subsecond, timeval;
char separator;
char separator[3];
int sign = 1;
if (hasSign && *time == '-') {
@@ -249,13 +249,16 @@ unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign)
time++;
}
if (sscanf(time,"%u:%u:%u%[,.:]%u",&hour,&minute,&second,&separator,&subsecond) < 5)
if (sscanf(time, "%u:%u:%u%[,.:]%u", &hour, &minute, &second, separator, &subsecond) < 5) {
return 0;
}
if (second > 60)
if (second > 60) {
second = 0;
if (subsecond > secondScale)
}
if (subsecond > secondScale) {
subsecond = 0;
}
timeval = hour * 60 * 60 + minute * 60 + second;
timeval = secondScale * timeval + subsecond;
+3 -3
View File
@@ -176,7 +176,7 @@ static NSArray* LoadVobSubSubtitles(NSURL *theDirectory, NSString *filename)
case VOB_SUB_STATE_READING_TRACK_HEADER:
if([line hasPrefix:@"id: "])
{
char *langStr = (char *)malloc([line length]);
char *langStr = (char *)malloc(line.length * sizeof(char));
int index;
sscanf([line UTF8String], "id: %s index: %d", langStr, &index);
size_t langLength = strlen(langStr);
@@ -195,9 +195,9 @@ static NSArray* LoadVobSubSubtitles(NSURL *theDirectory, NSString *filename)
break;
case VOB_SUB_STATE_READING_TRACK_DATA:
{
char *timeStr = (char *)malloc([line length]);
char *timeStr = (char *)malloc(line.length * sizeof(char));
unsigned int position;
sscanf([line UTF8String], "timestamp: %s filepos: %x", timeStr, &position);
sscanf(line.UTF8String, "timestamp: %s filepos: %x", timeStr, &position);
long time = ParseSubTime(timeStr, 1000, YES);
free(timeStr);
if(position > subFileSize)