On Sat 12 Feb 2022 at 23:25:55 -0800, David Chmelik wrote: > > When a segfault occurs, execute the command "backtrace". > This is some further information seen when running it and the > backtrace, The only thing different last few years is I've been trying to > read a few hundred newsgroups on Eternal-September (backup server AIOE) and > Gmane. > > IA__gtk_tree_view_column_set_fixed_width: assertion 'fixed_width > 0' failed > IA__gdk_window_get_state: assertion 'GDK_IS_WINDOW (window)' failed > > (gdb) backtrace > #0 0x00007ffff6acf4bc in ____strtoll_l_internal () at /lib64/libc.so.6 > #1 0x00007ffff6acb710 in atoi () at /lib64/libc.so.6 > #2 0x0000000000730692 in pan::DataImpl::load_headers(pan::DataIO const&, > pan::Quark const&) (this=0x7fffffffd340, data_io=..., group=...) > at headers.cc:573
Ok, I'm not familiar with this code and I also haven't tried it in a debugger, but here is some analysis from just observing. If in frame # atoi() crashes, it must have gotten a bad pointer (such as NULL). It gets it from line 573 in headers.cc: if (gotline && !expired) { StringView tok; s.ltrim (); s.pop_token (tok); const int number (atoi (tok.str)); <<< here s is also a StringView, and pop_token puts the next word from it in tok: bool StringView :: pop_token (StringView& token, char delimiter) { const bool got_token (len != 0); const char * pch = strchr (delimiter); if (pch) { token.str = str; token.len = pch - str; len -= token.len+1; str += token.len+1; } else { token.str = str; token.len = len; str = 0; len = 0; } return got_token; } token.src can never be a NULL pointer unless (this.)str already is NULL. It looks like s.ltrim() can leave the str pointer NULL, if the string is empty after trimming whitespace: void StringView :: ltrim () { // strip leading whitespace if (!empty()) { ..blah.. eat_chars (p-str); } } void StringView :: eat_chars (size_t n) { n = std::min (n, len); len -= n; str = len ? str+n : 0; <<<< here: can set to NULL } For this case, it would probably to to check tok.empty() before doing calling atoi (tok.str). I'm not sure what input it's trying to parse there: input from an nntp server, or data that Pan wrote to a file earlier. In any case, clearly it needs more checks. There are several other cases a bit earlier in the file where atoi(tok.str) is called without checking if the token is valid or not... -Olaf. -- ___ "Buying carbon credits is a bit like a serial killer paying someone else to \X/ have kids to make his activity cost neutral." -The BOFH falu.nl@rhialto
signature.asc
Description: PGP signature
_______________________________________________ Pan-users mailing list Pan-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/pan-users