lynx-dev
[Top][All Lists]
Advanced

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

[Lynx-dev] Lynx divide by zero


From: Gisle Vanem
Subject: [Lynx-dev] Lynx divide by zero
Date: Sat, 15 Jan 2005 09:39:48 +0100

Lynx 2.8.6dev.11 (05 Jan 2005) on MingW:
lynx -trace http://definitions.symantec.com/defs/20050114-008-i32.exe

Dr MingW crash report:
lynx.exe caused an Integer Divide By Zero at location 004b1586 in module 
LYNX.EXE.

Registers:
eax=0b90ec18 ebx=00001000 ecx=00000000 edx=00000000 esi=0002f5ff edi=00000000
eip=004b1586 esp=0022dbc0 ebp=0022dce8 iopl=0         nv up ei pl zr na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246

Call stack:
004B1586  LYNX.EXE:004B1586  ws_netread  HTTP.c:318
int ws_netread(
       int fd = 112,
       char * buf = &'i',
       int len = 4096
)
       ...
       ws_read_per_sec = g_total_bytes / (g_total_times / 1000);
           } else {
      ws_read_per_sec = g_total_bytes * 1000 / g_total_times;
           }
           ret_val = exitcode;
       ...

----------------------

ECX == 0 is probably the g_total_times variable.

AFAICS, since the download is so fast, process_time becomes 0 in
the below else part. Easy patch:

--- HTTP.c.orig Sat Jan 15 09:33:23 2005
+++ HTTP.c      Sat Jan 15 09:30:05 2005
@@ -304,11 +304,13 @@
               HTInfoMsg("Thread terminate Failed");
           }
           now_TickCount = GetTickCount();
-           if (now_TickCount > save_TickCount)
+           if (now_TickCount >= save_TickCount)
               process_time = now_TickCount - save_TickCount;
           else
               process_time = now_TickCount + (0xffffffff - save_TickCount);

+            if (process_time == 0)
+               process_time = 1;
           g_total_times += process_time;
           g_total_bytes += exitcode;

--gv





reply via email to

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