summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguruprasadX, pawse <guruprasadx.pawse@intel.com>2013-12-17 18:41:51 +0530
committerSteve Kondik <steve@cyngn.com>2016-08-24 11:02:03 -0700
commit5308e9a0288411656eebd9e8eb58519f272e2ff9 (patch)
treeac29ad7276a9ec5c2d081a61db172e5b40ad9edf
parent3c74c11c30cdae95914c0b6a9228a3906b238c73 (diff)
downloadandroid_external_flac-staging/cm-14.1-cafrebase.tar.gz
android_external_flac-staging/cm-14.1-cafrebase.tar.bz2
android_external_flac-staging/cm-14.1-cafrebase.zip
Noise and sometimes tombstone crash observed while seeking FLAC content during playbackstaging/cm-14.1-cafrebasecm-14.1_prerebasecm-14.1_oldcm-14.0
This patch resolves two issues: 1. Segmentation fault while seeking. 2. Noise during seek. The rootcause of both the above issue are same. Issue happens due to memory corruption of FLAC write buffer during seek. Due to this incorrect address we always observe noise during seek and sometimes the memory read causes seg fault whenever the memory access goes beyond the valid range. Change-Id: If76ca4ab614a02f8b324fc51684d5d9cf25073c8 Signed-off-by: guruprasadX, pawse <guruprasadx.pawse@intel.com> Signed-off-by: Mazhar <mazharx.sameullah@intel.com>
-rw-r--r--libFLAC/stream_decoder.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libFLAC/stream_decoder.c b/libFLAC/stream_decoder.c
index 27bac3e..3ede26f 100644
--- a/libFLAC/stream_decoder.c
+++ b/libFLAC/stream_decoder.c
@@ -177,6 +177,7 @@ typedef struct FLAC__StreamDecoderPrivate {
#if FLAC__HAS_OGG
FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */
#endif
+ FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS];
} FLAC__StreamDecoderPrivate;
/***********************************************************************
@@ -2959,13 +2960,12 @@ FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder
/* shift out the samples before target_sample */
if(delta > 0) {
unsigned channel;
- const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS];
for(channel = 0; channel < frame->header.channels; channel++)
- newbuffer[channel] = buffer[channel] + delta;
+ decoder->private_->newbuffer[channel] = (FLAC__int32 *)buffer[channel] + delta;
decoder->private_->last_frame.header.blocksize -= delta;
decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta;
/* write the relevant samples */
- return decoder->private_->write_callback(decoder, &decoder->private_->last_frame, newbuffer, decoder->private_->client_data);
+ return decoder->private_->write_callback(decoder, &decoder->private_->last_frame, (const FLAC__int32 * const *)decoder->private_->newbuffer, decoder->private_->client_data);
}
else {
/* write the relevant samples */