[Bug 2041] [1.16.2] "sed" segmentation fault

bugzilla at busybox.net bugzilla at busybox.net
Sun Jun 20 07:01:03 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2041

--- Comment #12 from my.somewhat.lengthy.loginname at gmail.com  ---

00000000 <add_input_file>:

    push   %ebx

    mov    %eax,%ebx    ; EBX = EAX = file pointer,
                ; as passed to the function

; bb_error_msg("file: %p", file);
    push   %eax        ; EAX: file pointer
    push   $0x128        ; location of text string
    call   bb_error_msg

; G.input_file_list = xrealloc_vector( etc. )
    mov    0x14,%ecx    ; 0x14: G.input_file_count
    mov    $0x402,%edx    ; why $0x402?
    mov    0x1c,%eax    ; 0x1c: G.input_file_list
    call   xrealloc_vector_helper
    mov    %eax,0x1c    ; 0x1c: G.input_file_list

; G.input_file_list[G.input_file_count] = file;

    ; ?

    ; pretty please?

    ; that's right, it simply does not do that

; First bb_error_msg on the stored file pointer
    ; GCC does not actually look it up in the G structure,
    ; but uses the copy in EBX. The output is the
    ; function parameter.
    push   %ebx        ; EBX: file pointer
    push   $0x131        ; location of text string
    call   bb_error_msg

; Second bb_error_msg on the stored file pointer
    ; This time GCC does look it up in the G structure.
    ; Because nothing was ever stored there, the output is (nil).
    mov    0x1c,%eax    ; 0x1c: G.input_file_list
    mov    0x14,%edx    ; 0x14: G.input_file_count
    pushl  (%eax,%edx,4)    ; must be GAS for [eax + edx*4]
    push   $0x131        ; location of text string
    call   bb_error_msg

; G.input_file_count++
    incl   0x14        ; 0x14: G.input_file_count

    add    $0x18,%esp
    pop    %ebx
    ret

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list