Valgrind errors from downloads.cc
Jeremy wrote:
Valgrind is reporting uninitialised data in DLItem::update() in downloads.cc[1]. Here's the code with the offending lines (705, 706) marked.
/* Rate */ if (csec >= 2) { tsec = (float) (curr_time - twosec_time); ! rate = ((float)(curr_bytesize-twosec_bytesize) / 1024) / tsec; ! snprintf(str, 64, (rate < 100) ? "%.1fK/s" : "%.0fK/s", rate); prRate->copy_label(str); prRate->redraw_label(); }
I'm wondering what is happening here. DLItem::update() is scheduled to be run every second. I think that twosec_time is only set to an initialised value when the function has been run at least twice before. Also, csec is calculated from the difference between the current time and the initial time. Is it possible that the "csec >= 2" could be true even when the function has been run only once before? After all, the timing of callbacks is never exact. Perhaps the callback should explicitly count how many times it has been called rather than attempt to work it out from the timing?
(The list software never did send me a copy of your msg...) Would something like the following work? --- a/dpi/downloads.cc Tue Jan 11 01:18:28 2011 +0000 +++ b/dpi/downloads.cc Sun Feb 06 20:40:53 2011 +0000 @@ -318,6 +318,8 @@ // Init value. Reset later, upon the first data bytes arrival init_time = time(NULL); + twosec_time = onesec_time = init_time; + // BUG:? test a URL with ' inside. /* escape "'" character for the shell. Is it necessary? */ esc_url = Escape_uri_str(url, "'");
[1] http://starurchin.org/dillo/valgrind.html http://starurchin.org/dillo/valgrind/6444c6ff40e01e517ce6e802f23670c5422c6e5... http://starurchin.org/dillo/valgrind/68bd8732669bbac8e11f1ea5a692db022fc6a6a... http://starurchin.org/dillo/valgrind/6f1d6a4feadf8136cbed37497a1d6dbbfea4a3f... http://starurchin.org/dillo/valgrind/68026e750cc92b08699c26392ecfd92cf370a96...
On Wed, Feb 09, 2011 at 05:14:21PM +0000, corvid wrote:
Jeremy wrote:
Valgrind is reporting uninitialised data in DLItem::update() in downloads.cc[1]. Here's the code with the offending lines (705, 706) marked.
/* Rate */ if (csec >= 2) { tsec = (float) (curr_time - twosec_time); ! rate = ((float)(curr_bytesize-twosec_bytesize) / 1024) / tsec; ! snprintf(str, 64, (rate < 100) ? "%.1fK/s" : "%.0fK/s", rate); prRate->copy_label(str); prRate->redraw_label(); }
I'm wondering what is happening here. DLItem::update() is scheduled to be run every second. I think that twosec_time is only set to an initialised value when the function has been run at least twice before. Also, csec is calculated from the difference between the current time and the initial time. Is it possible that the "csec >= 2" could be true even when the function has been run only once before? After all, the timing of callbacks is never exact. Perhaps the callback should explicitly count how many times it has been called rather than attempt to work it out from the timing?
(The list software never did send me a copy of your msg...)
Strange. Although I remember the wearlab was down a few days ago...
Would something like the following work?
--- a/dpi/downloads.cc Tue Jan 11 01:18:28 2011 +0000 +++ b/dpi/downloads.cc Sun Feb 06 20:40:53 2011 +0000 @@ -318,6 +318,8 @@ // Init value. Reset later, upon the first data bytes arrival init_time = time(NULL);
+ twosec_time = onesec_time = init_time; + // BUG:? test a URL with ' inside. /* escape "'" character for the shell. Is it necessary? */ esc_url = Escape_uri_str(url, "'");
Most probably. I have a vague memory of noticing the issue when coding it long ago, but not caring much as the following second the display would be updated with correct data. -- Cheers Jorge.-
Using snapshots of dillo from the last several months, with both fltk 2.0 r7513 and r7525 on FreeBSD 9-CURRENT amd64, I'm able to consistently crash dillo with a segfault by scrolling to the bottom of many pages at www.youtube.com with the mouse or keyboard. The same problem does not occur if I disable the use of remote CSS. Has anyone else noticed this problem? Regards, b. ____________________________________________________________________________________ Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/
bf wrote:
Using snapshots of dillo from the last several months, with both fltk 2.0 r7513 and r7525 on FreeBSD 9-CURRENT amd64, I'm able to consistently crash dillo with a segfault by scrolling to the bottom of many pages at www.youtube.com with the mouse or keyboard. The same problem does not occur if I disable the use of remote CSS. Has anyone else noticed this problem?
I can reproduce this. It probably has something to do with the transparent borders change that I made in December...
I wrote:
bf wrote:
Using snapshots of dillo from the last several months, with both fltk 2.0 r7513 and r7525 on FreeBSD 9-CURRENT amd64, I'm able to consistently crash dillo with a segfault by scrolling to the bottom of many pages at www.youtube.com with the mouse or keyboard. The same problem does not occur if I disable the use of remote CSS. Has anyone else noticed this problem?
I can reproduce this. It probably has something to do with the transparent borders change that I made in December...
My transparent borders code and Jorge's border code were fighting with each other. Does the attached fix it for you? Jorge: Were any of those borderColor.top for a reason, or just oversights? If the latter, I can think of a simple change that would be less error-prone :)
--- On Wed, 2/9/11, corvid <corvid@lavabit.com> wrote:
bf wrote:
Using snapshots of dillo from the last several months, with both fltk 2.0 r7513 and r7525 on FreeBSD 9-CURRENT amd64, I'm able to consistently crash dillo with a segfault by scrolling to the bottom of many pages at www.youtube.com with the mouse or keyboard.? The same
From: corvid <corvid@lavabit.com> Subject: Re: [Dillo-dev] Recent problems with remote css and youtube To: dillo-dev@dillo.org Date: Wednesday, February 9, 2011, 9:35 PM I wrote: problem does not occur if I disable the use of remote CSS.? Has anyone else noticed this problem?
I can reproduce this. It probably has something to do
with the
transparent borders change that I made in December...
My transparent borders code and Jorge's border code were fighting with each other. Does the attached fix it for you?
Yes, it seems to fix it: with the patch applied, I have not been able to reproduce the problem. Thanks, b.
participants (3)
-
bf2006a@yahoo.com
-
corvid@lavabit.com
-
jcid@dillo.org