Opened 14 years ago
Closed 14 years ago
#9919 closed Bug Report - Crash (fixed)
LogPrintLine leads to crash
| Reported by: | Owned by: | beirdo | |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.25 |
| Component: | MythTV - General | Version: | Master Head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
Logging a string containing a '%' character can lead to a crash.
#0 0x04932a58 in wcslen () from /lib/tls/i686/cmov/libc.so.6
#1 0x04933c3d in wcsrtombs () from /lib/tls/i686/cmov/libc.so.6
#2 0x048f72c4 in vfprintf () from /lib/tls/i686/cmov/libc.so.6
#3 0x04916460 in vsnprintf () from /lib/tls/i686/cmov/libc.so.6
#4 0x01745fc1 in LogPrintLine (mask=32768, level=LOG_INFO,
file=0x947a8f "subtitlescreen.cpp", line=763,
function=0x947ec4 "DisplayCC608Subtitles",
format=0x8f3e0c0 "x 0 y 15 uline=0 ital=0 color=0 coord=102,610 String: 'ABOUT 78% SURE.'") at mythlogging.cpp:758
#5 0x006448d8 in SubtitleScreen::DisplayCC608Subtitles (this=0xae984ae0)
at subtitlescreen.cpp:761
#6 0x006404da in SubtitleScreen::Pulse (this=0xae984ae0)
at subtitlescreen.cpp:97
#7 0x00634509 in OSD::DrawDirect (this=0x8da0930, painter=0x8ebc050,
size=..., repaint=true) at osd.cpp:565
#8 0x006a6f64 in VideoOutputVDPAU::PrepareFrame (this=0xa993e278,
frame=0x94b9c68, scan=kScan_Interlaced, osd=0x8da0930)
at videoout_vdpau.cpp:506
#9 0x005ad377 in MythPlayer::AVSync (this=0xac71788, buffer=0x94b9c68,
limit_delay=false) at mythplayer.cpp:1741
#10 0x005b0a0a in MythPlayer::DisplayNormalFrame (this=0xac71788,
check_prebuffer=true) at mythplayer.cpp:2054
#11 0x005b160e in MythPlayer::VideoLoop (this=0xac71788)
at mythplayer.cpp:2205
...
Change History (2)
Note:
See TracTickets
for help on using tickets.

Fix log messages containing %
Fixed #9919
The issue here is that after the fully formatted QString is converted to a char *, it is still run through vsnprintf as that is common code with the C implementation. To fix this, I have added a regexp-based replace in the macro that will convert "%" or "%%" to "%%". This will account for places we already put "%%" into the QString, and for those we did not.