[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Windows CVS 1.12.12.1 Latest + Patch - "version" Command Hangs But :
From: |
Conrad T. Pino |
Subject: |
RE: Windows CVS 1.12.12.1 Latest + Patch - "version" Command Hangs But :pserver: Not Busy |
Date: |
Sat, 24 Sep 2005 15:22:03 -0700 |
> From: Derek Price [mailto:derek@ximbiot.com]
>
> > need 4294967286
>
> That does look awfully big. Some sort of initialization or byte-order
> problem, perhaps? Byte-order sounds unlikely since this runs on x86
> linux, but figuring out where that value came from should provide a clue.
I think it's an underflow bug since as both "need" and "size" are "size_t"
which is "unsigned int" for VC6.
If "nbytes" > "need" then "need -= nbytes;" makes "need" *BIG* quickly.
A patch the like following will help but IMO the real questions are:
1. Did "need" change type from "int" to "size_t" recently?
2. Why is the server returning more than "need"?
3. Is the initial "need" smaller than it used to be?
4. Where else might we have similar underflow problems?
Index: src/socket-client.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/socket-client.c,v
retrieving revision 1.15
diff -u -p -r1.15 socket-client.c
--- src/socket-client.c 26 May 2005 08:24:17 -0000 1.15
+++ src/socket-client.c 24 Sep 2005 22:15:02 -0000
@@ -143,8 +143,16 @@ socket_buffer_input( void *closure, char
else
return 0;
}
- need -= nbytes;
- size -= nbytes;
+ if (nbytes < need)
+ need -= nbytes;
+ else
+ need = 0;
+
+ if (nbytes < size)
+ size -= nbytes;
+ else
+ size = 0;
+
data += nbytes;
*got += nbytes;
}