Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 294034 - media-plugins/vdr-epgsearch-0.9.24-r2 build with pcre crashes when using regex search pattern
Summary: media-plugins/vdr-epgsearch-0.9.24-r2 build with pcre crashes when using rege...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High critical (vote)
Assignee: Gentoo VDR Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-22 10:56 UTC by Stefan Bauer
Modified: 2011-01-20 15:40 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Bauer 2009-11-22 10:56:18 UTC
After adding the following search timer (extract from /etc/vdr/plugins/epgsearch.conf, notice the ".*")

31:Workingmen.* Death:0:::0:0:0:4:1:1:1:0:::1:0:0:0::50:99:10:20:0:0:0::0:0:1:1:1:0:0:0:0:1:0:0::1:0:0:0:0:0:0:0:0:0

VDR crashes everytime epgsearch's search time thread is started.

This does not happen if I build vdr-epgsearch w/o pcre use.

The system is up to date. I already run revdep-rebuild and lafilefixer. Rebuilding vdr, vdr-epgsearch and libpcre does not fix this.

Reproducible: Always

Steps to Reproduce:
1. Add a search timer containing a regex
2. Wait until search timer thread is run the next time


Actual Results:  
VDR crashes and is restarted by the init-script.

Expected Results:  
VDR should not crash.

dev-libs/libpcre-7.9-r1
media-video/vdr-1.6.0_p2
Comment 1 Stefan Bauer 2009-11-22 11:00:01 UTC
Portage 2.1.6.13 (default/linux/x86/10.0, gcc-4.3.4, glibc-2.9_p20081201-r2, 2.6.30-gentoo-r8 i686)
=================================================================
System uname: Linux-2.6.30-gentoo-r8-i686-Intel-R-_Pentium-R-_4_CPU_1.80GHz-with-gentoo-1.12.13
Timestamp of tree: Sat, 21 Nov 2009 12:00:01 +0000
distcc 3.1 i686-pc-linux-gnu [enabled]
app-shells/bash:     4.0_p28
dev-lang/python:     2.6.2-r1
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium4 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distcc distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://gentoo.mneisen.org/ "
LANG="de_DE.utf8@euro"
LDFLAGS="-Wl,-O1"
LINGUAS="de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="   "
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac acl alsa bash-completion berkdb bzip2 cddb cdio cli cracklib dri dvb gdbm gif git iconv jpeg lirc md5sum mmx modules mp3 mpeg ncurses nls nptl nptlonly opengl pam pcre png pppd readline reflection rtc session spl sse sse2 ssl subversion symlink sysfs tiff truetype unicode vcd vdr vidix vim-syntax vorbis win32codecs x264 x86 xcb xext xine xorg xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard lirc mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" LIRC_DEVICES="serial" USERLAND="GNU" VIDEO_CARDS="mga radeon"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

Comment 2 Stefan Bauer 2009-11-22 11:12:11 UTC
This is VDR's log (watchdog disabled):


Nov 22 12:06:57 [vdr] [23753] cTimeMs: using monotonic clock (resolution is 1 ns)
Nov 22 12:06:57 [vdr] [23754] VDR version 1.6.0-2 started
Nov 22 12:06:57 [vdr] [23754] switched to user 'vdr'
Nov 22 12:06:57 [vdr] [23754] running as daemon (tid=23754)
Nov 22 12:06:57 [vdr] [23754] codeset is 'UTF-8' - known
Nov 22 12:06:57 [vdr] [23754] found 23 locales in /usr/share/vdr/locale
Nov 22 12:06:57 [vdr] [23754] loading plugin: /usr/lib/vdr/plugins/libvdr-xineliboutput.so.1.6.0
Nov 22 12:06:57 [vdr] [23754] loading plugin: /usr/lib/vdr/plugins/libvdr-femon.so.1.6.0
Nov 22 12:06:57 [vdr] [23754] loading plugin: /usr/lib/vdr/plugins/libvdr-osdteletext.so.1.6.0
Nov 22 12:06:57 [vdr] [23754] loading plugin: /usr/lib/vdr/plugins/libvdr-quickepgsearch.so.1.6.0
Nov 22 12:06:57 [vdr] [23754] loading plugin: /usr/lib/vdr/plugins/libvdr-epgsearch.so.1.6.0
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/setup.conf
Nov 22 12:06:57 [vdr] [23754] [xine..put] Skipping configuration entry Frontend=none (overridden in command line)
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/sources.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/diseqc.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/channels.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/timers.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/commands.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/reccmds.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/svdrphosts.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/remote.conf
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/keymacros.conf
Nov 22 12:06:57 [vdr] [23757] video directory scanner thread started (pid=23754, tid=23757)
Nov 22 12:06:57 [vdr] [23757] video directory scanner thread ended (pid=23754, tid=23757)
Nov 22 12:06:57 [vdr] [23759] video directory scanner thread started (pid=23754, tid=23759)
Nov 22 12:06:57 [vdr] [23759] video directory scanner thread ended (pid=23754, tid=23759)
Nov 22 12:06:57 [vdr] [23754] reading EPG data from /mnt/data/video/epg.data
Nov 22 12:06:57 [vdr] [23754] probing /dev/dvb/adapter0/frontend0
Nov 22 12:06:57 [vdr] [23770] CI adapter on device 0 thread started (pid=23754, tid=23770)
Nov 22 12:06:57 [vdr] [23771] tuner on device 1 thread started (pid=23754, tid=23771)
Nov 22 12:06:57 [vdr] [23772] section handler thread started (pid=23754, tid=23772)
Nov 22 12:06:57 [vdr] [23754] probing /dev/dvb/adapter1/frontend0
Nov 22 12:06:57 [vdr] [23774] CI adapter on device 1 thread started (pid=23754, tid=23774)
Nov 22 12:06:57 [vdr] [23775] tuner on device 2 thread started (pid=23754, tid=23775)
Nov 22 12:06:57 [vdr] [23776] section handler thread started (pid=23754, tid=23776)
Nov 22 12:06:57 [vdr] [23754] found 2 video devices
Nov 22 12:06:57 [vdr] [23754] initializing plugin: xineliboutput (1.0.4): X11/xine-lib Ausgabe-Plugin
Nov 22 12:06:57 [vdr] [23754] [xine..put] cTimePts: clock_gettime(CLOCK_MONOTONIC): clock resolution 0 us
Nov 22 12:06:57 [vdr] [23754] [xine..put] cTimePts: using monotonic clock
Nov 22 12:06:57 [vdr] [23754] [xine..put] RTP SSRC: 0x1ab3a061
Nov 22 12:06:57 [vdr] [23777] ERROR (thread.c,225): Keine Berechtigung
Nov 22 12:06:57 [vdr] [23777] [xine..put] cUdpScheduler: Can't nice to value: -5
Nov 22 12:06:57 [vdr] [23754] initializing plugin: femon (1.1.5): DVB Signal Informationsanzeige (OSD)
Nov 22 12:06:57 [vdr] [23754] initializing plugin: osdteletext (0.5.1): Zeigt den Videotext auf dem OSD an
Nov 22 12:06:57 [vdr] [23754] initializing plugin: quickepgsearch (0.0.1): Schnelle Suche nach Sendungen
Nov 22 12:06:57 [vdr] [23754] initializing plugin: epgsearch (0.9.24): Suche im EPG nach Wiederholungen und anderem
Nov 22 12:06:57 [vdr] [23754] setting primary device to 3
Nov 22 12:06:57 [vdr] [23754] assuming manual start of VDR
Nov 22 12:06:57 [vdr] [23754] SVDRP listening on port 2001
Nov 22 12:06:57 [vdr] [23754] setting current skin to "sttng"
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/themes/sttng-default.theme
Nov 22 12:06:57 [vdr] [23754] starting plugin: xineliboutput
Nov 22 12:06:57 [vdr] [23778] Remote decoder/display server (cXinelibServer) thread started (pid=23754, tid=23778)
Nov 22 12:06:57 [vdr] [23778] ERROR (thread.c,225): Keine Berechtigung
Nov 22 12:06:57 [vdr] [23778] [xine..put] cXinelibServer: Can't set priority to SCHED_RR 2 [1,99]
Nov 22 12:06:57 [vdr] [23778] [xine..put] Listening on port 37890
Nov 22 12:06:57 [vdr] [23778] [xine..put] Listening for UDP broadcasts on port 37890
Nov 22 12:06:57 [vdr] [23778] [discovery] BROADCAST: VDR xineliboutput DISCOVERY 1.0__Server port: 37890__Server version: xineliboutput-1.0.4____
Nov 22 12:06:57 [vdr] [23754] [xine..put] cXinelibDevice::StartDevice(): Device started
Nov 22 12:06:57 [vdr] [23754] starting plugin: femon
Nov 22 12:06:57 [vdr] [23754] plugin 'femon' called obsolete function RegisterI18n()
Nov 22 12:06:57 [vdr] [23754] starting plugin: osdteletext
Nov 22 12:06:57 [vdr] [23754] plugin 'osdteletext' called obsolete function RegisterI18n()
Nov 22 12:06:57 [vdr] [23754] starting plugin: quickepgsearch
Nov 22 12:06:57 [vdr] [23754] starting plugin: epgsearch
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/plugins/epgsearch/epgsearchmenu.conf
Nov 22 12:06:57 [vdr] [23754] EPGSearch: loading /etc/vdr/plugins/epgsearch/epgsearch.conf
Nov 22 12:06:57 [vdr] [23754] EPGSearch: loading /etc/vdr/plugins/epgsearch/epgsearchdone.data
Nov 22 12:06:57 [vdr] [23754] loading /etc/vdr/plugins/epgsearch/timersdone.conf
Nov 22 12:06:57 [vdr] [23754] EPGSearch: loading /etc/vdr/plugins/epgsearch/epgsearchupdmail.templ
Nov 22 12:06:57 [vdr] [23779] EPGSearch: searchtimer thread started (pid=23754, tid=23779)
Nov 22 12:06:57 [vdr] [23780] EPGSearch: conflictcheck thread started (pid=23754, tid=23780)
Nov 22 12:06:59 [vdr] [23754] switching to channel 78
Nov 22 12:06:59 [vdr] [23785] transfer thread started (pid=23754, tid=23785)
Nov 22 12:06:59 [vdr] [23786] receiver on device 1 thread started (pid=23754, tid=23786)
Nov 22 12:06:59 [vdr] [23787] TS buffer on device 1 thread started (pid=23754, tid=23787)
Nov 22 12:06:59 [vdr] [23754] setting watchdog timer to 60 seconds

[my timers]

Nov 22 12:06:59 [vdr] [23770] CAM 1: no module present
Nov 22 12:06:59 [vdr] [23754] connect from 127.0.0.1, port 48918 - accepted
Nov 22 12:06:59 [vdr] [23754] closing SVDRP connection
Nov 22 12:06:59 [vdr] [23774] CAM 2: no module present
Nov 22 12:06:59 [vdr] [23774] CAM 3: no module present
Nov 22 12:07:05 [vdr] [23754] max. latency time 1 seconds
Nov 22 12:07:17 [vdr] [23779] EPGSearch: search timer update started
Nov 22 12:07:17 [vdr] [23780] EPGSearch: timer conflict check started
Nov 22 12:07:17 [vdr] [23780] EPGSearch: timer conflict check finished
Comment 3 Andreas Cz. 2009-11-25 23:50:46 UTC
I can confirm the behaviour.
And, I have a plausible patch that works at least for me:

--- ./epgsearchtools.c.orig     2009-11-24 20:31:20.000000000 +0100
+++ ./epgsearchtools.c  2009-11-26 00:07:04.000000000 +0100
@@ -354,7 +354,7 @@
       {
          regex_t re;
 
-         if ( 0 == regcomp(&re, searchText, REG_EXTENDED) )
+         if ( 0 == regcomp(&re, searchText, REG_EXTENDED | REG_NOSUB) )
          {
             int status = regexec( &re, szTest, 0, NULL, 0);
             regfree(&re);

It is assumed that the libpcre function
  regexec(regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
crashes due to the arguments nmatch and pmatch being 0 and NULL, respectively.
The manual to pcreposix(3) states that these arguments are ignored when regcomp() gets the flag REG_NOSUB set. While the normal regex functions also ignore the zero/NULL arguments nmatch and pmatch, libpcre obviously does so _only_ if REG_NOSUB is given.

Same problem with epgsearch-0.9.25_beta14 .
Comment 4 Andreas Cz. 2009-11-27 17:42:47 UTC
Things are not quite that simple, sorry.

I noticed that regular expressions containing at least one bar '|' (several branches) will still _not_ work with my above patch (no crash, but also no results).

Digging deeper showed a different problem with USE=pcre:
The libvdr-epgsearch.so is linked with -lpcreposix ,
vdr itself is not linked against libpcreposix.so .
When vdr loads libvdr-epgsearch.so, there seems no need to load libpcreposix.so , since regcomp(), regexec(), regfree() are already available in libc.so .

Now, is there a possibility to force loading another shared library (libpcreposix.so) when libvdr-epgsearch.so is loaded? And if so, what would happen to calls to regcomp() et al. from other parts of vdr, would they now be directed to libpcreposix, too?

One possibility (maybe not acceptable) would be to give other names to the pcreposix functions to avoid clobbering symbol names. Probably the function names in the source can remain and be re-#defined in pcreposix.h .

Any ideas for a clean and sustainable solution are welcome.
Comment 5 Christian Ruppert (idl0r) archtester Gentoo Infrastructure gentoo-dev Security 2011-01-20 13:42:39 UTC
Is this issue still persistent with media-plugins/vdr-epgsearch-0.9.25_beta20?
Comment 6 Joerg Bornkessel gentoo-dev 2011-01-20 15:40:03 UTC
(In reply to comment #5)
> Is this issue still persistent with media-plugins/vdr-epgsearch-0.9.25_beta20?
> 

plz use for tests --> media-plugins/vdr-epgsearch-0.9.25_beta20-r1

media-plugins/vdr-epgsearch-0.9.25_beta20 was buggy in use-flag manipulation of Makefile, was removed from tree yes