[Bug 2041] [1.16.2] "sed" segmentation fault
bugzilla at busybox.net
bugzilla at busybox.net
Sun Jun 20 01:27:22 UTC 2010
https://bugs.busybox.net/show_bug.cgi?id=2041
--- Comment #9 from my.somewhat.lengthy.loginname at gmail.com ---
Here is the original add_input_file() function:
static void add_input_file(FILE *file)
{
G.input_file_list = xrealloc_vector(G.input_file_list, 2,
G.input_file_count);
G.input_file_list[G.input_file_count++] = file;
}
and here is a functional replacement that I made, enriched with console
messages:
static void add_input_file(FILE *file)
{
bb_error_msg("file: %p", file);
G.input_file_list = xrealloc_vector(G.input_file_list, 2,
G.input_file_count);
G.input_file_list[G.input_file_count] = file;
bb_error_msg("G.input_file_list[G.input_file_count]: %p",
G.input_file_list[G.input_file_count]);
bb_error_msg("G.input_file_list[G.input_file_count]: %p",
G.input_file_list[G.input_file_count]);
G.input_file_count++;
}
The replacement function checks, *twice* in a row, whether the file pointer was
correctly stored. The result is:
root [/tmp/busybox-1.16.2] ./busybox_unstripped echo 1234 |
./busybox_unstripped sed 's/23//'
sed: file: 0x81cc3c0
sed: G.input_file_list[G.input_file_count]: 0x81cc3c0
sed: G.input_file_list[G.input_file_count]: (nil)
Segmentation fault
root [/tmp/busybox-1.16.2]
--
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