summaryrefslogtreecommitdiffstats
path: root/libFLAC
diff options
context:
space:
mode:
authorguruprasadX, pawse <guruprasadx.pawse@intel.com>2013-12-17 18:41:51 +0530
committerSteve Kondik <steve@cyngn.com>2015-11-23 17:25:16 -0800
commit72a7ede4d73ea48fb2ceeaa56d5ad50997048e5d (patch)
treec2c7c3c496c54240c1e5ed4f2e4e20fcf6138204 /libFLAC
parent8e7de0cac99e88fbe2245a5d74a205ff1b42a80c (diff)
downloadandroid_external_flac-72a7ede4d73ea48fb2ceeaa56d5ad50997048e5d.tar.gz
android_external_flac-72a7ede4d73ea48fb2ceeaa56d5ad50997048e5d.tar.bz2
android_external_flac-72a7ede4d73ea48fb2ceeaa56d5ad50997048e5d.zip
Noise and sometimes tombstone crash observed while seeking FLAC content during playback
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>
Diffstat (limited to 'libFLAC')
-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 d13b23b..7d93bb7 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;
/***********************************************************************
@@ -2952,13 +2953,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 */