I have some old recordings made on 2005 which does not have info file. This caused vdr 1.7.17 to crash because in tools.c line 1194 there is no check whether the file parameter passed is NULL or not. Real cause for the crash is in the vdrrip plugins which should handle the case where the info file does not exist on setLengthVDR method on movie.c. Anyway, it's propably good idea also to has the NULL check's in vdr's own code. Patches attached for tools.c and recording.c.

#0  0x00007ffff640e8ff in getdelim () from /lib64/libc.so.6
#1 0x00000000004fcd48 in getline (this=0x7fffffffde30, f=0x0) at /usr/include/bits/stdio.h:118
#2  cReadLine::Read (this=0x7fffffffde30, f=0x0) at tools.c:1194
#3 0x00000000004cc383 in cRecordingInfo::Read (this=0xc29bc0, f=0x0) at recording.c:419 #4 0x00007fffef0397a0 in cMovie::setLengthVDR() () from ./PLUGINS/lib/libvdr-vdrrip.so.1.7.17 #5 0x00007fffef03af00 in cMovie::cMovie(char const*, char const*) () from ./PLUGINS/lib/libvdr-vdrrip.so.1.7.17 #6 0x00007fffef0367d7 in cMenuVdrripMovie::cMenuVdrripMovie(char const*, char const*) () from ./PLUGINS/lib/libvdr-vdrrip.so.1.7.17 #7 0x00007fffef03807d in cMenuVdrripEncode::ProcessKey(eKeys) () from ./PLUGINS/lib/libvdr-vdrrip.so.1.7.17


[lamikr@tinka Prisma:_Einstein_ja_kaiken_teoria]$ ls -la 2005-04-21.20\:58.50.99.rec/
total 1338080
drwxr-xr-x 2 76 76       4096 2008-05-17 17:48 ./
drwxr-xr-x 3 76 76       4096 2008-05-17 17:46 ../
-rw-r--r-- 1 76 76 1369418800 2008-05-17 17:48 001.vdr
-rw-r--r-- 1 76 76     727968 2008-05-17 17:48 index.vdr
-rw-r--r-- 1 76 76          4 2008-05-17 17:48 resume.vdr
-rw-r--r-- 1 76 76        441 2008-05-17 17:48 summary.vdr


>From ef2f4122b44abbc4cae7876bb8566ed95151cdf5 Mon Sep 17 00:00:00 2001
From: Mika Laitio <lam...@pilppa.org>
Date: Sun, 3 Apr 2011 13:06:55 +0300
Subject: [PATCH 1/2] NULL pointer check to cReadline.read in tools.c

Signed-off-by: Mika Laitio <lam...@pilppa.org>
---
 tools.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/tools.c b/tools.c
index d03595e..c09a9b0 100644
--- a/tools.c
+++ b/tools.c
@@ -1191,18 +1191,20 @@ cReadLine::~cReadLine()
 
 char *cReadLine::Read(FILE *f)
 {
-  int n = getline(&buffer, &size, f);
-  if (n > 0) {
-     n--;
-     if (buffer[n] == '\n') {
-        buffer[n] = 0;
-        if (n > 0) {
-           n--;
-           if (buffer[n] == '\r')
-              buffer[n] = 0;
+  if (f != NULL) {
+     int n = getline(&buffer, &size, f);
+     if (n > 0) {
+        n--;
+        if (buffer[n] == '\n') {
+           buffer[n] = 0;
+           if (n > 0) {
+              n--;
+              if (buffer[n] == '\r')
+                 buffer[n] = 0;
+              }
            }
+        return buffer;
         }
-     return buffer;
      }
   return NULL;
 }
-- 
1.7.3.4

>From 18385a3641f8fb6003824462b0e982edbf248f93 Mon Sep 17 00:00:00 2001
From: Mika Laitio <lam...@pilppa.org>
Date: Sun, 3 Apr 2011 13:12:20 +0300
Subject: [PATCH 2/2] NULL pointer check for file at cRecordingInfo::Read(FILE 
*f)

Signed-off-by: Mika Laitio <lam...@pilppa.org>
---
 recording.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/recording.c b/recording.c
index 02a6e61..07528a2 100644
--- a/recording.c
+++ b/recording.c
@@ -412,7 +412,7 @@ void cRecordingInfo::SetFramesPerSecond(double 
FramesPerSecond)
 
 bool cRecordingInfo::Read(FILE *f)
 {
-  if (ownEvent) {
+  if (f && ownEvent) {
      cReadLine ReadLine;
      char *s;
      int line = 0;
-- 
1.7.3.4

_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to