FS#11286 - PictureFlow segfault when showing tracklist or playing - fixed.
I've been working on PictureFlow - WPS Integration. I repeatedly had cases where showing a tracklist or playing for certain albums would cause a segfault. I tracked this down to a bug in the track list indexing. It only occurs under certain memory allocation circumstances that doesn't occur as readily with the std build. I have attached here a patch to fix it.
Explanation: the create_track_index requests memory for building a track index. The variable "tracks" references an array descending from the buffer top end. When a reallocation occurs it currently only moves the "tracks" position when a track count > 0. However, in some cases a reallocation occurs before the first track is stored and in that case the "tracks" position gets left in the middle of the track_names data causing corruption and then segfault. I've moved the (track_count > 0) decision so that it only controls moving tracks struct data. The "tracks" offset must happen even when track_count is 0.
This patch fixes the segfault on my Sansa Fuze v2 and in UISim. Tested against r26114.
I would expect the same result in other platforms.
I've also included this bug fix in my PictureFlow - WPS Integration patch until this bug fix gets accepted.
This task depends upon