summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2008-01-08 23:48:51 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2008-01-08 23:48:51 +0000
commit659fe5a35bad0483f67f52ba032b02de98d49407 (patch)
treeeff26be00dd26a27622ce73b3ea9b145f0311414
parent5fd859b68a47583eb26e5d6ebfb51b883d3b0761 (diff)
downloadrockbox-659fe5a35bad0483f67f52ba032b02de98d49407.tar.gz
rockbox-659fe5a35bad0483f67f52ba032b02de98d49407.zip
Fix FS#6215 (player crashes after trying to resume deleted music file). As mentioned in the lastest comment, the problem was in trying to resume at an offset larger than the size of the file following the one that was deleted. This revealed a crash in the buffering code, which gets a fix, but we also need to intervene earlier in the track loading so that the track that gets played will be from its start.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16028 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/buffering.c3
-rw-r--r--apps/playback.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 531413bcb4..2d7ca22368 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -880,6 +880,9 @@ int bufopen(const char *file, size_t offset, enum data_type type)
880 size_t size = filesize(fd); 880 size_t size = filesize(fd);
881 bool can_wrap = type==TYPE_PACKET_AUDIO || type==TYPE_CODEC; 881 bool can_wrap = type==TYPE_PACKET_AUDIO || type==TYPE_CODEC;
882 882
883 if (offset > size)
884 offset = 0;
885
883 struct memory_handle *h = add_handle(size-offset, can_wrap, false); 886 struct memory_handle *h = add_handle(size-offset, can_wrap, false);
884 if (!h) 887 if (!h)
885 { 888 {
diff --git a/apps/playback.c b/apps/playback.c
index 1e5cd626de..ed581cd36a 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1683,6 +1683,9 @@ static bool audio_load_track(int offset, bool start_play)
1683 1683
1684 tracks[track_widx].filesize = filesize(fd); 1684 tracks[track_widx].filesize = filesize(fd);
1685 1685
1686 if ((unsigned)offset > tracks[track_widx].filesize)
1687 offset = 0;
1688
1686 /* Set default values */ 1689 /* Set default values */
1687 if (start_play) 1690 if (start_play)
1688 { 1691 {