On Sat, 2 Jun 2001, Maxim Sobolev wrote:

> It seems that something is wrong with sscanf(3) in -current - in
> some cases it may cause SIGBUS. I failed to reproduce the
> problem on 4-STABLE, so it is a -current specific bug. Attached
> please find small showcase that exposes the bug in question
> and a backtrace after SIGBUS.
> 
> Please fix.
> 
> -Maxim
> 
> #include <stdio.h>
> int
> main()
> {
>       float sub;
>       sscanf("59e", "%f", &sub);
>       exit(0);
> }
> 
> (gdb) r
> Starting program: /tmp/bug/a.out 
> Program received signal SIGBUS, Bus error.
> 0x280b3ad8 in __ungetc () from /usr/lib/libc.so.5
> (gdb) bt
> #0  0x280b3ad8 in __ungetc () from /usr/lib/libc.so.5
> #1  0x280b36b1 in __svfscanf () from /usr/lib/libc.so.5
> #2  0x280b25a3 in sscanf () from /usr/lib/libc.so.5
> #3  0x80484c0 in main () at bug.c:8
> #4  0x80483f5 in _start ()

This is because fp->_extra is not initialized by sscanf() (it is stack
garbage that happened to be 0 when I looked at it).

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to