mozeq / test

testing repo for playing with the github API
0 stars 0 forks source link

[PATCH] SIGSEGV when syslog line is empty #142

Closed mozeq closed 11 years ago

mozeq commented 11 years ago

Opened '20090704T10:01:38' by mnowak as https://fedorahosted.org/abrt/ticket/57

{{{ newman ~ $ sudo gdb cvs/abrt-root/usr/sbin/abrt GNU gdb (GDB) Fedora (6.8.50.20090302-32.fc11) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i586-redhat-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... (gdb) set args -d (gdb) run Starting program: /home/newman/cvs/abrt-root/usr/sbin/abrt -d [Thread debugging using libthread_db enabled] warning: .dynamic section for "/lib/libresolv.so.2" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations Debug: Plugin FileTransfer (0.0.6) succesfully loaded. Debug: Plugin SOSreport (0.0.2) succesfully loaded. Debug: Plugin Logger (0.0.1) succesfully loaded. Debug: Plugin SQLite3 (0.0.1) succesfully loaded. Debug: Plugin KerneloopsReporter (0.0.1) succesfully loaded. Debug: Plugin KerneloopsScanner (0.0.1) succesfully loaded. Debug: Plugin Mailx (0.0.2) succesfully loaded. Debug: Plugin Kerneloops (0.0.2) succesfully loaded. Debug: Plugin RunApp (0.0.1) succesfully loaded. Debug: Plugin CCpp (0.0.1) succesfully loaded. Debug: Plugin Python (0.0.1) succesfully loaded. warning: .dynamic section for "/usr/lib/libxmlrpc.so.3" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/usr/lib/libxmlrpc_util.so.3" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations Debug: Plugin Bugzilla (0.0.1) succesfully loaded. Debug: Registred plugin CCpp(Analyzer) Debug: Registred plugin Kerneloops(Analyzer) Debug: Registred plugin KerneloopsReporter(Reporter) Debug: Registred plugin KerneloopsScanner(Action) Debug: Registred plugin Logger(Reporter) Debug: Registred plugin SQLite3(Database) Debug: Scanning for unsaved entries... Debug: Runnig... Debug: Activating plugin: KerneloopsScanner Debug: Scanning dmesg... Debug: Scanning syslog...

Program received signal SIGSEGV, Segmentation fault. 0x00641b3e in two_way_short_needle (needle_len=, needle=, haystack_len=, haystack=) at str-two-way.h:273 273 while (i < needle_len && (CANON_ELEMENT (needle[i]) Current language: auto; currently minimal Missing separate debuginfos, use: debuginfo-install nss-3.12.3-4.fc11.i586 nss-softokn-freebl-3.12.3.99.3-2.11.2.fc11.i586 (gdb) thread apply all bt

Thread 1 (Thread 0xb7fde730 (LWP 18755)):

0 0x00641b3e in two_way_short_needle (needle_len=, needle=,

haystack_len=<value optimized out>, haystack=<value optimized out>) at str-two-way.h:273

1 memmem (needle_len=, needle=, haystack_len=,

haystack=<value optimized out>) at memmem.c:72

2 0x009f41a6 in CSysLog::FillLinePointers (this=0x807df88,

buffer=0xb7cd1008 "Jun 28 13:19:14 assam kernel: imklog 3.21.11, log source = /proc/kmsg started.", buflen=1098828, 
remove_syslog=1) at KerneloopsSysLog.cpp:168

3 0x009f43f6 in CSysLog::ExtractOops (this=0x807df88,

buffer=0xb7cd1008 "Jun 28 13:19:14 assam kernel: imklog 3.21.11, log source = /proc/kmsg started.", buflen=1098828, 
remove_syslog=1) at KerneloopsSysLog.cpp:227

4 0x009f1cbd in CKerneloopsScanner::ScanSysLogFile (this=0x807df80, filename=0x807deb4 "/var/log/messages", issyslog=1)

at KerneloopsScanner.cpp:140

5 0x009f1d9f in CKerneloopsScanner::Run (this=0x807df80, pActionDir="/home/newman/cvs/abrt-root/var/cache/abrt", pArgs="")

at KerneloopsScanner.cpp:33

6 0x007dde24 in CMiddleWare::RunAction (this=0x805d930, pActionDir="/home/newman/cvs/abrt-root/var/cache/abrt",

pPluginName="KerneloopsScanner", pPluginArgs="") at MiddleWare.cpp:198

7 0x0804c00c in CCrashWatcher::cron_activation_periodic_cb (data=0x807ab08) at CrashWatcher.cpp:142

8 0x058d93ac in g_timeout_dispatch (source=0x807de60, callback=0x3, user_data=0x807ab08) at gmain.c:3260

9 0x058d8cf8 in g_main_dispatch (context=) at gmain.c:1824

10 IA__g_main_context_dispatch (context=) at gmain.c:2377

11 0x058dc370 in g_main_context_iterate (context=0x805cab0, block=, dispatch=1, self=0x80942f8)

at gmain.c:2455

12 0x058dc7df in IA__g_main_loop_run (loop=0x805c4d8) at gmain.c:2663

13 0x0804cb6a in CCrashWatcher::Run (this=0x805c5c8) at CrashWatcher.cpp:579

14 0x08053206 in main (argc=2, argv=0xbffff7f4) at Daemon.cpp:76

}}}

This was ran with '-d' but without it exits after 10 s anyway. Happens with both Git/master and 0.0.4.

mozeq commented 11 years ago

Added '20090705T16:55:46' by 'mnowak'

Reproducer: {{{ root log # cat /var/log/messages Jul 3 18:49:10 assam kernel: }}}

There's nothing ("") after ':'.

{{{ Debug: Scanning syslog... @@ linepointer = , len = -1 Segmentation fault (core dumped) }}}

Patch follows.

{{{ diff --git a/lib/Plugins/KerneloopsSysLog.cpp b/lib/Plugins/KerneloopsSysLog.cpp index 11dfa99..bcccfea 100644 --- a/lib/Plugins/KerneloopsSysLog.cpp +++ b/lib/Plugins/KerneloopsSysLog.cpp @@ -165,9 +165,11 @@ int CSysLog::FillLinePointers(char _buffer, size_t buflen, int removesyslog) *c9 = '\0'; / turn the \n into a string termination */

    /* if we see our own marker, we know we submitted everything upto here already */
mozeq commented 11 years ago

Added '20090811T07:23:58' by 'mnowak'

Fixed by: http://git.fedorahosted.org/git/abrt.git?p=abrt.git;a=commitdiff;h=6cb98fb02176d0a24474d9843f2648b7ed824a31