[Http-crcsync] crccache ready for some testing I think

Rusty Russell rusty at rustcorp.com.au
Tue Mar 31 00:25:05 EDT 2009


On Tuesday 31 March 2009 14:36:55 Rusty Russell wrote:
> On Tuesday 31 March 2009 14:24:37 Rusty Russell wrote:
> > On Tuesday 31 March 2009 07:58:08 Alex Wulms wrote:
> > > Rusty,
> > > 
> > > Attached test program crashes on my PC with the latest libcrc. Am I doing 
> > > something wrong? 
> > 
> > How weird.  It works fine on 32 bit.
> > 
> > Fortunately, the testsuite *also* fails on 64 bit.
> 
> Fix committed.  long vs unsigned int issue.

But that doesn't fix *your* crash.

For that, you need this as well:

=== modified file 'ccan/crcsync/crcsync.c'
--- ccan/crcsync/crcsync.c	2009-03-30 00:08:38 +0000
+++ ccan/crcsync/crcsync.c	2009-03-31 04:20:06 +0000
@@ -192,7 +192,11 @@
 		if (ctx->literal_bytes > ctx->block_size) {
 			*result = ctx->literal_bytes - ctx->block_size;
 			ctx->literal_bytes -= *result;
-			ctx->buffer_start += *result;
+			/* Advance buffer. */
+			if (*result >= buffer_size(ctx))
+				ctx->buffer_start = ctx->buffer_end = 0;
+			else
+				ctx->buffer_start += *result;
 		} else
 			*result = 0;
 


More information about the Http-crcsync mailing list