[Toybox] Valgrind errors with toybox bc

Zach van Rijn me at zv.io
Tue Aug 28 10:13:51 PDT 2018


On Tue, 2018-08-28 at 01:45 -0500, Sasha Toltec wrote:
> Here are the valgrind errors that were requested.
> 

Hi Sasha,

Thank you for your prompt response.

> The problem seems to be that if you don't understand what types of
> numbers put stress on a bignum library, then it is
> difficult/impossible to force the memory errors.

In your particular example below, the case "sqrt(.1)" would have
worked just as well; the full `.0000000000123` is unnecessary.

> If one of the senior programmers involved with toybox has time to take
> a look at the bc bignum library and suggest some fixes and reading
> material to its authors that would perhaps be the best course of
> action. Toltec Enterprises generally charges for consultation ergo
> cannot offer much more input.

It would be unwise to retain the consulting services of a group
that both (a) denigrates the developers of a community project
and (b) neglects to compile a project with the '-g' flag before
posting an otherwise useless Valgrind report. [1] and [2]:

> sasha at sasha:~/toybox$ uname -a
> Linux sasha 4.4.0-103-generic #126-Ubuntu SMP Mon Dec 4 16:23:28 UTC
> 2017 x86_64 x86_64 x86_64 GNU/Linux
> sasha at sasha:~/toybox$ make bc
> sasha at sasha:~/toybox$ echo "sqrt(.0000000000123)" | valgrind ./bc
> ==10636== Memcheck, a memory error detector
> ==10636== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==10636== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
> ==10636== Command: ./bc -l
> ==10636==
> ==10636== Invalid read of size 1
> ==10636==    at 0x402D68: ??? (in /home/sasha/toybox/bc)
> ==10636==    by 0x403C3B: ??? (in /home/sasha/toybox/bc)
> ==10636==    by 0xFFEFFF84F: ???
> ==10636==    by 0x15: ???
> ==10636==    by 0x5945C9F: ???
> ==10636==    by 0x15: ???
> ==10636==    by 0x16: ???
> ==10636==    by 0x23: ???
> ==10636==  Address 0x5945aef is 1 bytes before a block of size 55 alloc'd
> ==10636==    at 0x4C2DB8F: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==10636==    by 0x402FFB: ??? (in /home/sasha/toybox/bc)
> ...
> 

If you have particular issues with the `bc' project, maybe it
would be better to address those with the `bc' authors? This
mailing list may not be the appropriate venue for technical
discussion of a particular memory issue in one of the "pending"
toys (whereas integration and conformance issues would).

This `bc' is, in itself, dozens to hundreds of times larger
than the other toys.


Zach van Rijn


[1]: http://lists.landley.net/pipermail/toybox-landley.net
/2018-August/009634.html and previous emails from "Sasha".

[2]: http://lists.landley.net/pipermail/toybox-landley.net
/2018-August/009635.html




More information about the Toybox mailing list