From 962f5593445866e5d4a875ec0f24d8b1195bf8f5 Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Thu, 24 Aug 2017 09:33:26 +0900 Subject: [PATCH] Add to check NULL of pbSetup Change-Id: I5ab01613fdc188446677cd55632dbf036715e745 Signed-off-by: Jiyong Min --- formats/ffmpeg/mm_file_format_mmf.c | 33 +++++++++++++++++++-------------- packaging/libmm-fileinfo.spec | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/formats/ffmpeg/mm_file_format_mmf.c b/formats/ffmpeg/mm_file_format_mmf.c index 43e74e4..695bb94 100755 --- a/formats/ffmpeg/mm_file_format_mmf.c +++ b/formats/ffmpeg/mm_file_format_mmf.c @@ -1135,49 +1135,49 @@ _mmf_MspICheck(PTRACKINFO psTrack, PPHRASEINFO psPhrase) break; case AV_MMF_TAG_PHRASE_A: /* A melody */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[0].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[0].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; break; case AV_MMF_TAG_PHRASE_B: /* B melody */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[1].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[1].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; break; case AV_MMF_TAG_PHRASE_E: /* Ending */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[2].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[2].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; break; case AV_MMF_TAG_PHRASE_I: /* Intro */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[3].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[3].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; break; case AV_MMF_TAG_PHRASE_K: /* Interlude */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[4].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[4].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; break; case AV_MMF_TAG_PHRASE_R: /* Refrain */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[5].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[5].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; break; case AV_MMF_TAG_PHRASE_S: /* Bridge */ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B) - return ; + return; psPhrase[6].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3])); psPhrase[6].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7])); dIndex += AV_MMF_PHRAZE_SIZE_B; @@ -2296,10 +2296,10 @@ _mmf_GetHvData(PLOADINFO psLoad, unsigned char bCType) int sdChunkSize; if ((psLoad->dSmafType == AV_MMF_SMAF_TYPE_MA1) || (psLoad->dSmafType == AV_MMF_SMAF_TYPE_MA2)) - return ; + return; if ((bCType & 0x0F) == 0x08) - return ; + return; if (psLoad->dSmafType == AV_MMF_SMAF_TYPE_MA3) { pbHvData = psLoad->sTrack_Info[5].pbMthv; @@ -2310,7 +2310,7 @@ _mmf_GetHvData(PLOADINFO psLoad, unsigned char bCType) } if ((pbHvData == NULL) || (dHvDataSize < AV_MMF_CHUNK_HEADER_SIZE)) - return ; + return; pbVoice = NULL; pbScript = NULL; @@ -2324,7 +2324,7 @@ _mmf_GetHvData(PLOADINFO psLoad, unsigned char bCType) while (dHvDataSize > (dIndex + AV_MMF_CHUNK_HEADER_SIZE)) { sdChunkSize = _mmf_MalibNextChunk(&(pbHvData[dIndex]), (dHvDataSize - dIndex), AVMALIB_CHUNK_PHASE_MTHVSUB, &dChunkID, &dChunkNo); - if (sdChunkSize < 0) return ; + if (sdChunkSize < 0) return; dIndex += AV_MMF_CHUNK_HEADER_SIZE; switch (dChunkID) { case AVMALIB_CHUNKCODE_MHVS: @@ -2346,18 +2346,23 @@ _mmf_GetHvData(PLOADINFO psLoad, unsigned char bCType) dIndex += sdChunkSize; } + if (pbSetup == NULL) { + debug_error(DEBUG, "pbSetup is NULL.\n"); + return; + } + dIndex = 0; while (dSetupSize >= dIndex + 4) { wTag = (unsigned short)(((unsigned short)(pbSetup[dIndex]) << 8) + pbSetup[dIndex + 1]); wSize = (unsigned short)(((unsigned short)(pbSetup[dIndex + 2]) << 8) + pbSetup[dIndex + 3]); dIndex += 4; - if (dSetupSize < (dIndex + wSize)) return ; + if (dSetupSize < (dIndex + wSize)) return; if ((wTag == 0x4348) && (wSize == 1)) bHvCh = pbSetup[dIndex]; dIndex += wSize; } if ((pbScript == NULL) || (bHvCh >= AV_MMF_HV_CHANNEL_NULL)) - return ; + return; psLoad->sHV_Info.pbVoice = pbVoice; psLoad->sHV_Info.dVoiceSize = dVoiceSize; @@ -2365,7 +2370,7 @@ _mmf_GetHvData(PLOADINFO psLoad, unsigned char bCType) psLoad->sHV_Info.dScriptSize = dScriptSize; psLoad->sHV_Info.bHvChannel = bHvCh; - return ; + return; } /********************************************************************************* diff --git a/packaging/libmm-fileinfo.spec b/packaging/libmm-fileinfo.spec index f45c449..6cea7b1 100755 --- a/packaging/libmm-fileinfo.spec +++ b/packaging/libmm-fileinfo.spec @@ -1,6 +1,6 @@ Name: libmm-fileinfo Summary: Media Fileinfo -Version: 0.6.66 +Version: 0.6.67 Release: 0 Group: System/Libraries License: Apache-2.0 -- 2.7.4