Fixed a number of incorrect memory accesses
This commit is contained in:
1 parent
b06696f299
commit
f2ccd9e1d6
5 files changed
+18
-15
No files matched your search
@@ -618,12 +618,12 @@
|
|||||||
if (err && AudioChannelLayoutTag_GetNumberOfChannels(channelLayout->mChannelLayoutTag) == 6)
|
if (err && AudioChannelLayoutTag_GetNumberOfChannels(channelLayout->mChannelLayoutTag) == 6)
|
||||||
channelBitmap = 0x3F;
|
channelBitmap = 0x3F;
|
||||||
|
|
||||||
uint8_t fscod = 0;
|
uint64_t fscod = 0;
|
||||||
uint8_t bsid = 8;
|
uint64_t bsid = 8;
|
||||||
uint8_t bsmod = 0;
|
uint64_t bsmod = 0;
|
||||||
uint8_t acmod = 7;
|
uint64_t acmod = 7;
|
||||||
uint8_t lfeon = (channelBitmap & kAudioChannelBit_LFEScreen) ? 1 : 0;
|
uint64_t lfeon = (channelBitmap & kAudioChannelBit_LFEScreen) ? 1 : 0;
|
||||||
uint8_t bit_rate_code = 15;
|
uint64_t bit_rate_code = 15;
|
||||||
|
|
||||||
switch (AudioChannelLayoutTag_GetNumberOfChannels(channelLayout->mChannelLayoutTag) - lfeon) {
|
switch (AudioChannelLayoutTag_GetNumberOfChannels(channelLayout->mChannelLayoutTag) - lfeon) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeAllChapterTrackReferences(fileHandle);
|
removeAllChapterTrackReferences(fileHandle);
|
||||||
MP4SetChapters(fileHandle, fileChapters, i, MP4ChapterTypeAny);
|
MP4SetChapters(fileHandle, fileChapters, i, MP4ChapterTypeQt);
|
||||||
|
|
||||||
free(fileChapters);
|
free(fileChapters);
|
||||||
success = _Id = findChapterTrackId(fileHandle);
|
success = _Id = findChapterTrackId(fileHandle);
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
|
|||||||
if (readMkvPacket(_ioStream, trackInfo, FilePos, &frame, &FrameSize)) {
|
if (readMkvPacket(_ioStream, trackInfo, FilePos, &frame, &FrameSize)) {
|
||||||
// parse AC3 header
|
// parse AC3 header
|
||||||
// collect all the necessary meta information
|
// 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;
|
uint32_t lfe_offset = 4;
|
||||||
|
|
||||||
fscod = (*(frame+4) >> 6) & 0x3;
|
fscod = (*(frame+4) >> 6) & 0x3;
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ canOutput:
|
|||||||
unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign)
|
unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign)
|
||||||
{
|
{
|
||||||
unsigned hour, minute, second, subsecond, timeval;
|
unsigned hour, minute, second, subsecond, timeval;
|
||||||
char separator;
|
char separator[3];
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
|
|
||||||
if (hasSign && *time == '-') {
|
if (hasSign && *time == '-') {
|
||||||
@@ -249,13 +249,16 @@ unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign)
|
|||||||
time++;
|
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;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (second > 60)
|
if (second > 60) {
|
||||||
second = 0;
|
second = 0;
|
||||||
if (subsecond > secondScale)
|
}
|
||||||
|
if (subsecond > secondScale) {
|
||||||
subsecond = 0;
|
subsecond = 0;
|
||||||
|
}
|
||||||
|
|
||||||
timeval = hour * 60 * 60 + minute * 60 + second;
|
timeval = hour * 60 * 60 + minute * 60 + second;
|
||||||
timeval = secondScale * timeval + subsecond;
|
timeval = secondScale * timeval + subsecond;
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ static NSArray* LoadVobSubSubtitles(NSURL *theDirectory, NSString *filename)
|
|||||||
case VOB_SUB_STATE_READING_TRACK_HEADER:
|
case VOB_SUB_STATE_READING_TRACK_HEADER:
|
||||||
if([line hasPrefix:@"id: "])
|
if([line hasPrefix:@"id: "])
|
||||||
{
|
{
|
||||||
char *langStr = (char *)malloc([line length]);
|
char *langStr = (char *)malloc(line.length * sizeof(char));
|
||||||
int index;
|
int index;
|
||||||
sscanf([line UTF8String], "id: %s index: %d", langStr, &index);
|
sscanf([line UTF8String], "id: %s index: %d", langStr, &index);
|
||||||
size_t langLength = strlen(langStr);
|
size_t langLength = strlen(langStr);
|
||||||
@@ -195,9 +195,9 @@ static NSArray* LoadVobSubSubtitles(NSURL *theDirectory, NSString *filename)
|
|||||||
break;
|
break;
|
||||||
case VOB_SUB_STATE_READING_TRACK_DATA:
|
case VOB_SUB_STATE_READING_TRACK_DATA:
|
||||||
{
|
{
|
||||||
char *timeStr = (char *)malloc([line length]);
|
char *timeStr = (char *)malloc(line.length * sizeof(char));
|
||||||
unsigned int position;
|
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);
|
long time = ParseSubTime(timeStr, 1000, YES);
|
||||||
free(timeStr);
|
free(timeStr);
|
||||||
if(position > subFileSize)
|
if(position > subFileSize)
|
||||||
|
|||||||
Reference in new issue
Block a user