bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Segmentation fault with current development version of wg


From: Darshit Shah
Subject: Re: [Bug-wget] Segmentation fault with current development version of wget
Date: Wed, 1 May 2013 20:27:54 +0530

Couple of things.
First, sorry for the quick and dirty hack which was the perfect example of
how NOT to do things.

Secondly, it lies upon me that this feature wasn't tested before submitting
the patch. I had however relied on the Test Environment and since it passed
everything there, I thought it was working correctly. Guess, we should add
a test for this soon. --recursive is a commonly used switch with Wget and
not having a test to prevent regressions on it is very bad.

Lastly, I have spent some time on this issue today and figured out the
issue.
The SUSPEND_POST_DATA logic is so written that the macro is called on every
301/302 redirect. This did not pose any issues till now since when NOT
using --post-file or --post-data, the respective variables would be holding
a NULL value which is backed up and then restored without any problems.
However, with the addition of the --method option, I am explicitly setting
opt.method to POST on RESUME_POST_DATA since the macro is supposed to be
called only during POST requests. This is the source of the error.

The actual Segmentation Fault was being caused since I, in all my
foolishness did not strdup, but instead directly assigned the string to a
pointer.

I am fixing this issue, but it is a terribly ugly hack. If someone could
help improve it I'd be most truly grateful.
I have a couple of ideas, but I will need to work them out and implement
them when I have the time.

The reason it has to be so ugly is that, we cannot use strcmp or strcasecmp
on a NULL String, and we cannot initialize opt.method since that would
break some sanity checks which are in place so that --post-* and --body-*
commands don't conflict with each other.

Attachment: 0001-Fix-bug-in-program-logic-and-Seg-Fault.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]