Package: playmp3list
Version: 0.95-4.1+b1
Severity: normal
Tags: patch

When a playlist which has a blank line is opened, playmp3list segfaults.
The attached patch fixes this.

Steps to reproduce:

$ echo -e "a.mp3\n\nb.mp3" > test.m3u
$ playmp3list -d test.m3u
Reading rc file: /etc/playmp3listrc...
Loading theme: 'Ocean'
Attempting to compile playlist test.m3u...Caught signal SIGSEGV
(Segmentaion fault)

Please re-create this error, with debug logging enabled - i.e. run with
command-line option -d, then e-mail ~/playmp3list.debug together with a
description of what happened to the author, ur...@rucus.ru.ac.za

$ cat ~/playmp3list.debug 
Loading playlist 'test.m3u'...
Caught signal: 11

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.28
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages playmp3list depends on:
ii  libc6                     2.7-18         GNU C Library: Shared libraries
ii  libgcc1                   1:4.3.2-1.1    GCC support library
ii  libncurses5               5.7+20081220-1 shared libraries for terminal hand
ii  libstdc++6                4.3.2-1.1      The GNU Standard C++ Library v3
ii  mpg321 [mpg123]           0.2.10.6       mpg123 clone that doesn't use floa

playmp3list recommends no packages.

playmp3list suggests no packages.

-- no debconf information
>From ff62aa4618c684a30143117a725c94f524990ab0 Mon Sep 17 00:00:00 2001
From: Rabin Vincent <ra...@rab.in>
Date: Sat, 10 Jan 2009 16:08:21 +0530
Subject: [PATCH] Fix crash on empty lines in playlist

---
 playlist.cc |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/playlist.cc b/playlist.cc
index 48d8982..d6db5a9 100644
--- a/playlist.cc
+++ b/playlist.cc
@@ -294,8 +294,11 @@ mp3playlist::load_playlist(char *filename, bool pID3v1, bool pAlpha, bool pSortB
   add_item(".","../",FT_DIR);			// add standard entry
 
   char line[256];
-  while (fgets(line, 255, file))		// add all entries
-   add_item(strtok(line,"\n\r"),pID3v1);
+  while (fgets(line, 255, file)) {		// add all entries
+   char *p = strtok(line, "\n\r");
+   if (!p) continue;
+   add_item(p,pID3v1);
+  }
 
   fclose(file);	
 
-- 
1.5.6.5

Reply via email to