Nmap Development mailing list archives

Re: [PATCH] timing.cc integer overflow


From: David Fifield <david () bamsoftware com>
Date: Thu, 5 Feb 2009 01:36:54 +0100

On Wed, Feb 04, 2009 at 10:40:54PM +0100, Henri Doreau wrote:
Thanks for your detailed reply. Here is a new version of the patch. I
removed the remaining days too.

Looks better now, here is the output I get now with your testing code (mine
seems having a bug, shame on me :)) :

Thanks, I have committed this patch. However I think there's still some
work to do. The member function ScanProgressMeter::printStatsIfNecessary
does some of the same calculations as ScanProgressMeter::printStats, and
it still does them with longs. I don't know what the effect would be,
but it could cause the stats not to be printed when they should be, or
vice versa. Can you look at that function and do the calculations in the
same way, or (even better) remove the duplicated code into a separate
function?

I think that last lines are due to an overflow in the testing code for (days
== 50), as 50 * 86400UL * 1000 > 0xffffffff

   TIMEVAL_MSEC_ADD(tv, tv, days * 86400UL * 1000);

Yes, I think you're right. Those results were caused by a problem in the
test code.

Here's something I can't explain. Look at the results for 10 days
elapsed with 10% completion. That gives a completion date 100 days after
the start of the timer, which in the test code is set to 0:00:00,
January 1, 2009. For me the local time 100 days after the start of the
year will be 1:00 (or 0:59, that's just a rounding issue). That makes
sense, because that's April 10 and daylight savings time will have
started in the mountain time zone. But for you the local time of day
will be 23:00? Is there a time zone that moves the clock backwards that
time of year?

 10 days elapsed
 TEST Timing: About 0.00% done
-TEST Timing: About 10.00% done; ETC: 23:00 (2160:00:00 remaining)
-TEST Timing: About 20.00% done; ETC: 00:00 (960:00:00 remaining)
+TEST Timing: About 10.00% done; ETC: 00:59 (2159:59:59 remaining)
+TEST Timing: About 20.00% done; ETC: 23:59 (959:59:59 remaining)
 TEST Timing: About 30.00% done; ETC: 08:00 (560:00:00 remaining)

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: