Core dump, bus error, byte alignment, ObjStack
Alessandro Vesely <[email protected]>
| Newsgroups | gmane.comp.gnu.aspell.devel |
|---|---|
| Message-ID | <cone.1127057903.637210.29996.100@north> |
Hi,
the subject is the same as last year post from James Lee
http://lists.gnu.org/archive/html/aspell-devel/2004-05/msg00005.html
but the bug is different:
It occurs in the following context (gdb bt)
#0 clear_check_info (ci=@0x2ba743) at check_list.hpp:19
#1 0xff2f7990 in aspeller::GuessInfo::add (this=0xffbef098) at check_list.hpp:31
#2 0xff265270 in aspeller::LookupInfo::lookup (this=0xffbeef30, word=
{str_ = 0xffbeed68 "minchiar", size_ = 4294967295}, c=0x1f0, achar=122 'z', o=@0xffbeedb0,
gi=0xffbef098) at modules/speller/default/affix.cpp:1001
#3 0xff2660e8 in aspeller::SfxEntry::check (this=0xb61fc, linf=@0xffbeef30, word=
{str_ = 0x7c180 "minchia", size_ = 7}, ci=@0xffbeef08, gi=0xffbef098, optflags=0, ppfx=0x0)
at modules/speller/default/affix.cpp:1254
Even if CheckInfo has size 36, the dump shows the CheckInfo structure has an
odd address (ci=@0x2ba743). That's because of a previous GuessInfo::dup() for
an odd size.
The following apparently fixes it
--- modules/speller/default/check_list.hpp% 2005-09-18 17:21:54.689029000 +0200
+++ modules/speller/default/check_list.hpp 2005-09-18 17:21:54.699031000 +0200
@@ -27,7 +27,7 @@
void reset() { buf.reset(); num = 0; head = 0; }
CheckInfo * add() {
num++;
- CheckInfo * tmp = (CheckInfo *)buf.alloc_top(sizeof(CheckInfo));
+ CheckInfo * tmp = (CheckInfo *)buf.alloc_top(sizeof(CheckInfo), sizeof(void*));
clear_check_info(*tmp);
tmp->next = head;
head = tmp;