Hi, vdr 1.2.6 segfaults in the "What's on now?" screen if there are channels with Umlauts (e.g. WDR Köln). For some reason asprintf refuses those channels (Invalid or incomplete multibyte or wide character). vdr doesn't evaluate the return value of asprintf and therefore operates on broken (not necessarily NULL) pointers. I have no idea why asprintf suddenly behaves like that, I haven't seen such segfaults before. Nevertheless it's a bug in vdr to ignore the return value and to not check for NULL. Attached patch is for 1.2.6, 1.3.x needs a similar one. Does DVB define an encoding for channel names and EPG or do umlauts only work by accident? cu Ludwig -- (o_ Ludwig.Nussel@gmx.de //\ PGP Key ID: FF8135CE V_/_ ICQ: 52166811
Index: vdr-1.2.6/i18n.h =================================================================== --- vdr-1.2.6.orig/i18n.h 2004-06-11 13:25:19.986576600 +0200 +++ vdr-1.2.6/i18n.h 2004-06-11 13:27:05.709965918 +0200 @@ -28,4 +28,12 @@ #define tr(s) I18nTranslate(s) #endif +#ifndef asprintf +#define asprintf(x, rest...) \ + do { \ + int ret = asprintf(x, ##rest); \ + if(ret == -1) { LOG_ERROR; *x = NULL; } \ + } while(0) +#endif + #endif //__I18N_H Index: vdr-1.2.6/interface.c =================================================================== --- vdr-1.2.6.orig/interface.c 2004-06-11 13:25:19.983577241 +0200 +++ vdr-1.2.6/interface.c 2004-06-11 13:25:40.182257461 +0200 @@ -213,6 +213,10 @@ void cInterface::WriteText(int x, int y, const char *s, eDvbColor FgColor, eDvbColor BgColor) { + if(!s) { + esyslog("%s:%d: NULL", __FILE__, __LINE__); + s = "???"; + } if (open) { ClearEol(x, y, BgColor); int col = 0; Index: vdr-1.2.6/osd.c =================================================================== --- vdr-1.2.6.orig/osd.c 2004-06-11 13:25:19.985576813 +0200 +++ vdr-1.2.6/osd.c 2004-06-11 15:05:29.211305652 +0200 @@ -284,6 +284,12 @@ void cOsdItem::SetText(const char *Text, bool Copy) { free(text); + if(!Text) + { + esyslog("%s:%d: NULL", __FILE__, __LINE__); + Copy = true; + Text = "???"; + } text = Copy ? strdup(Text) : (char *)Text; // text assumes ownership! } @@ -382,6 +388,7 @@ void cOsdMenu::SetTitle(const char *Title, bool ShowDate) { free(title); + if(!Title) Title = "???"; if (ShowDate) asprintf(&title, "%s\t%s", Title, DayDateTime(time(NULL))); else
Attachment:
pgp00008.pgp
Description: PGP signature