PDA

View Full Version : [ViX_Misc] C++ coding bug - may be leading to crashes?



birdman
14-12-15, 04:30
I've just been looking at a crash report which ends:


< 2381.568316> Backtrace:
< 2381.568692> /usr/bin/enigma2(_Z17handleFatalSignaliP9siginfo_tPv) [0x45BC38]
< 2381.569052> /usr/bin/enigma2(_ZN22eListboxServiceContent22checkServiceI sRecordedE17eServiceReference) [0x56660A]
< 2381.569359> /usr/bin/enigma2(_ZN22eListboxServiceContent5paintER8gPaint erR12eWindowStyleRK6ePointi) [0x566CC0]
< 2381.569628> /usr/bin/enigma2(_ZN8eListbox5eventEiPvS0_) [0x4F5794]
< 2381.569873> /usr/bin/enigma2(_ZN7eWidget7doPaintER8gPainterRK7gRegioni) [0x4FF088]
< 2381.570171> /usr/bin/enigma2(_ZN7eWidget7doPaintER8gPainterRK7gRegioni) [0x4FF0C8]
< 2381.570439> /usr/bin/enigma2(_ZN7eWidget7doPaintER8gPainterRK7gRegioni) [0x4FF0C8]
< 2381.570692> /usr/bin/enigma2(_ZN14eWidgetDesktop10paintLayerEP7eWidgeti ) [0x501534]
< 2381.570934> /usr/bin/enigma2(_ZN14eWidgetDesktop5paintEv) [0x5015C0]
< 2381.571162> /usr/bin/enigma2(main) [0x4596D8]
< 2381.571288> /lib/libc.so.6(__libc_start_main) [0x76E05004]
< 2381.571325> -------FATAL SIGNAL

So a signal was raised in eListboxServiceContent::checkServiceIsRecorded (in lib/service/listboxservice.cpp).

A quick look at the code indicates that the call to eDVBResourceManager::getInstance(res) can fail. In that case the (currently unchecked) return value is -1, and res is not set. Since this is used as a pointer on the next line it's quite likely to lead to some error signal (SIGSEGV?) when used, so what about:
if (eDVBResourceManager::getInstance(res) == -1) {
return false;

Similarly the next line can return a negative result if there is no db (in which case db would be NULL?).

So, that should be:
if (res->getChannelList(db) < 0) {
return false.