[Aboriginal] Merry christmas, I have found two bugs

Rob Landley rob at landley.net
Wed Dec 26 17:43:08 PST 2012


On 12/26/2012 05:02:53 PM, Bjørn Forsman wrote:
> (gdb) bt
> #0  0xb6edbd34 in raise () from mnt_rootfs/lib/libc.so.0
> #1  0x00028d84 in __div0 () at
> /home/bfo/aboriginal/build/temp-armv5l/gcc-core/gcc/config/arm/lib1funcs.asm:1000
> #2  0x000280c8 in __udivsi3 () at
> /home/bfo/aboriginal/build/temp-armv5l/gcc-core/gcc/config/arm/lib1funcs.asm:754
> #3  0x0001a1d0 in next_column (ul=0, dtlen=16, columns=0,

Ah. It's the -C support (which is now the default behavior, new change  
last release). Which implies terminal_size() is setting TT.screen_width  
to an insane value (either 0 or 1), since columns is capped at  
TT.screen_width/2 and then we do a modulus on columns to find our rows  
and there's the division by zero error.

Right. And since 0 is filtered out in terminal_size() in lib/lib.c,  
this implies that ioctl(TIOCGWINSZ) is setting the screen width to 1.  
(Or something is setting COLUMNS=0 which would override the check.)

Either way:

   http://landley.net/hg/toybox/rev/017b8fd3c9ac

Not sure that's the proper fix but it'll do for now. (I may need to  
tweak the library function to never return insane values, but I need to  
add ascii probe logic ot it anyway.)

Thanks. I'm back poking at the other segfault now...

Rob
 1356572588.0


More information about the Aboriginal mailing list