From patchwork Thu Sep 15 20:27:54 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: skiller2k1 X-Patchwork-Id: 12027 Received: from pop.gmx.de ([213.165.64.20] helo=mail.gmx.net) by www.linuxtv.org with smtp (Exim 4.34) id 1EG0LE-0003vM-SA for vdr@linuxtv.org; Thu, 15 Sep 2005 22:28:20 +0200 Received: (qmail invoked by alias); 15 Sep 2005 20:27:46 -0000 Received: from i3ED6E115.versanet.de (EHLO cerebellum.mittelstation.de) [62.214.225.21] by mail.gmx.net (mp023) with SMTP; 15 Sep 2005 22:27:46 +0200 X-Authenticated: #2528061 From: skiller2k1 To: Klaus Schmidinger's VDR Subject: Re: [vdr] vdr-1.3.32 segfault when reading summary.vdr Date: Thu, 15 Sep 2005 22:27:54 +0200 User-Agent: KMail/1.8.2 References: <4329B037.6010705@web.de> In-Reply-To: <4329B037.6010705@web.de> MIME-Version: 1.0 Message-Id: <200509152227.54151.skiller2k1@gmx.net> X-Y-GMX-Trusted: 0 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: skiller2k1@gmx.net, Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 20:28:20 -0000 Status: O X-Status: X-Keywords: X-UID: 5005 Am Donnerstag 15 September 2005 19:32 schrieb Achim Tuffentsammer: > Hi list, > > I have a summary.vdr file from the old days > which crashes vdr 1.3.32 when trying to read it. > > Attached is the summary.vdr file and a small > patch to recording.c which prevents vdr from > crashing. > > Achim Hi Achim, i patched it another way ;) See attached file. Michi --- vdr-1.3.32/recording.c 2005-09-15 21:24:30.000000000 +0200 +++ vdr-1.3.32.patch/recording.c 2005-09-15 21:13:21.000000000 +0200 @@ -477,7 +477,7 @@ FILE *f = fopen(SummaryFileName, "r"); if (f) { int line = 0; - char *data[3] = { NULL }; + char *data[3] = { NULL, NULL, NULL }; cReadLine ReadLine; char *s; while ((s = ReadLine.Read(f)) != NULL) { @@ -501,19 +501,21 @@ data[1] = NULL; } else if (line == 2) { - // if line 1 is too long, it can't be the short text, - // so assume the short text is missing and concatenate - // line 1 and line 2 to be the long text: - int len = strlen(data[1]); - if (len > 80) { - data[1] = (char *)realloc(data[1], len + 1 + strlen(data[2]) + 1); - strcat(data[1], "\n"); - strcat(data[1], data[2]); - free(data[2]); - data[2] = data[1]; - data[1] = NULL; + if (data[1]) { + // if line 1 is too long, it can't be the short text, + // so assume the short text is missing and concatenate + // line 1 and line 2 to be the long text: + int len = strlen(data[1]); + if (len > 80) { + data[1] = (char *)realloc(data[1], len + 1 + strlen(data[2]) + 1); + strcat(data[1], "\n"); + strcat(data[1], data[2]); + free(data[2]); + data[2] = data[1]; + data[1] = NULL; + } } - } + } info->SetData(data[0], data[1], data[2]); for (int i = 0; i < 3; i ++) free(data[i]);