summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguruprasadX, pawse <guruprasadx.pawse@intel.com>2013-12-17 18:41:51 +0530
committerSteve Kondik <steve@cyngn.com>2014-11-30 01:45:18 -0800
commit2d7ee624e1dc703fb66f6b186888be64c7e97434 (patch)
tree0103739fc7cc9aaa8de97f7dfc0c123c47f3e733
parent457fe12432caac0de0e430bb976dab681b3ae1a2 (diff)
downloadandroid_external_flac-stable/cm-12.1-YOG3C.tar.gz
android_external_flac-stable/cm-12.1-YOG3C.tar.bz2
android_external_flac-stable/cm-12.1-YOG3C.zip
Noise and sometimes tombstone crash observed while seeking FLAC content during playbackstaging/cm-12.1stable/cm-12.1-YOG3Cstable/cm-12.0-YNG1I
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 916fde6..c20cb66 100644
--- a/libFLAC/stream_decoder.c
+++ b/libFLAC/stream_decoder.c
@@ -205,6 +205,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;
/***********************************************************************
@@ -2935,13 +2936,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 */