ThomasDickey / original-mawk

bug-reports for mawk (originally on GoogleCode)
http://invisible-island.net/mawk/mawk.html
17 stars 2 forks source link

Bus error in check_strnum() #56

Closed q3cpma closed 4 years ago

q3cpma commented 5 years ago

Hello,

the command ./test.awk test.db - <test.in gives me a bus error. Neither gawk nor busybox awk do. Here are the important files:

FILENAME == ARGV[1]\ { full = $0 sub("^[0-9]+ ", "") db[$0] = full next } db[$0] {print db[$0]; next} {print 0, $0}

* test.db:

0 /home/user/Data/Music/Initial D/(1998) 1st Stage ~D Selection 1~ 0 /home/user/Data/Music/Initial D/(1998) 1st Stage ~D Selection 2~

* test.in:

/home/user/Data/Music/Initial D/(1998) 1st Stage ~D Selection 1~ /home/user/Data/Music/Initial D/(1998) 1st Stage ~D Selection 2~


and here's the gdb output:

gdb -q ~/Programming/mawk-1.3.4-20171017/mawk Reading symbols from /home/user/Programming/mawk-1.3.4-20171017/mawk...done. (gdb) run -f test.awk test.db - <test.in Starting program: /home/user/Programming/mawk-1.3.4-20171017/mawk -f test.awk test.db - <test.in 0 /home/user/Data/Music/Initial D/(1998) 1st Stage ~D Selection 1~

Program received signal SIGBUS, Bus error. 0x0000555555561798 in check_strnum (cp=cp@entry=0x5555555842d8 <eval_stack+24>) at cast.c:323 323 if (s == q) (gdb) bt full

0 0x0000555555561798 in check_strnum (cp=cp@entry=0x5555555842d8 <eval_stack+24>) at cast.c:323

    temp = 0x7ffff7a39760 <_IO_2_1_stdout_> "\204*\255", <incomplete sequence \373>
    s = 0x555555590bac "test.db"
    q = 0xaaaaaab2188c <error: Cannot access memory at address 0xaaaaaab2188c>

1 0x000055555555caa8 in compare (cp=cp@entry=0x5555555842c0 ) at execute.c:1389

    result = 0
    len = <optimized out>

2 0x000055555555e54b in execute (cdp=0x555555592780, sp=0x5555555842c0 , fp=0x0) at execute.c:946

    cp = <optimized out>
    t = <optimized out>
    tu = <optimized out>
    aloop_state = 0x0
    old_stack_base = 0x0
    old_sp = 0x0
    force_exit = 1

3 0x000055555555c53a in main (argc=5, argv=0x7fffffffe658) at main.c:71

No locals.

ThomasDickey commented 5 years ago

thanks - I can duplicate this

ThomasDickey commented 4 years ago

This was fixed in 20181114