memory access woes in bogofilter or db-4.0.14?

Matthias Andree matthias.andree at gmx.de
Wed Jan 8 04:21:01 CET 2003


Matthias Andree <matthias.andree at gmx.de> writes:

> Hi,
>
> I have a tough one. gcc 3.2, gcc 2.95.4 (FreeBSD), db-4.0.14, current
> CVS (i. e. 2003-01-08 02:20 GMT), ix86 Linux or FreeBSD. I am running
> make check under valgrind 1.9.3 or ElectricFence 2.2.2 supervision and
> get illegal accesses.  Here's the patch that I'm using on top of the CVS

OK, I believe I figured it out. The length of the data is NOT in the ulen,
but in the size member of DBT after ->get(). The interesting thing is
that get() is expecting 8 bytes, count + date, but is only getting 4
bytes.

I figured some swap_32bit issues on the way, and I'm wondering what date
we should read if the data size is short (i. e. no date present) -- I'm
using 0 for now, feel free to change it.

I wonder if we can afford the db_data.data length inconsistencies
without having an explicit tag in the data base. If the user changes the
timestamp option, he'll have to recreate his data base to get useful
results.

BTW, looking closer, it seems as though the timestamp handling code was
inconsistent throughout the code. Most stuff uses db_setvalue, not
db_setvalue_and_date. There should be only one function offered, which
sets both. This last issue I'm not fixing.

-- 
Matthias Andree




More information about the bogofilter-dev mailing list