FS#5690 - Fix for memory corruption when using .talk clips

Attached to Project: Rockbox
Opened by Steve Bavin (pondlife) - Friday, 21 July 2006, 15:58 GMT
Task Type Patches
Category User Interface
Status Closed
Assigned To No-one
Operating System All players
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The memory allocation for the thumbnail buffer (used for .talk clips) previously assumed that the start of the audio buffer would not move, but if used with other features (notably dircache) this is not true. This resolves bug #5662.

This patch updates talk.c to properly allocate a fixed thumbnail buffer (up to 32K, should be plenty). It also updates audiobuf properly when a voice file is loaded.
This task depends upon

Closed by  Linus Nielsen Feltzing (linusnielsen)
Tuesday, 01 August 2006, 22:05 GMT
Reason for closing:  Accepted
Additional comments about closing:  Tested on Archos Recorder without problems.
Comment by Steve Bavin (pondlife) - Friday, 21 July 2006, 16:00 GMT
Note, I have tested this on H300 device and simulator. I have not tested it on a HWCODEC device, but the bug should still be fixed on such devices. It would be good if someone with a working Archos could give this a test though.
Comment by Steve Bavin (pondlife) - Tuesday, 01 August 2006, 20:35 GMT
Here's an updated version that only implements this change on SWCODEC configurations. Other (i.e. Archos) devices regularly switch between mp3 and .talk clip playback, calling reset_state() and so keeping pointers in sync, so no crash will occur. This version works the same but will not use up 32K on Archoses; only downside is it uses #if statements.
Comment by Steve Bavin (pondlife) - Tuesday, 01 August 2006, 21:12 GMT
OK, here's take 3 - this one still only affects SWCODEC. It uses buffer_alloc to allocate memory and allocates the thumbnail buffer up-front (no dynamic cleverness that could cause a crash). This is in talkbufferfix3.patch. Once this is applied, the application of allowtalkduringplay.patch will enable voicing via .talk clips during playback (on SWCODEC). This last part in particular needs testing on Archos - somebody - please...!
Comment by Steve Bavin (pondlife) - Tuesday, 01 August 2006, 21:24 GMT
Updated version of tree patch to save Archos units from spinning up to check if a .talk file exists when the audio is playing and they won't be used anyway.