valgrind confirms that wisodev's patch
diff -urd flake-enc/libflake/encode.c flake-svn-2006-09-19-patched-win32-src/libflake/encode.c
--- flake-enc/libflake/encode.c 2006-09-20 10:39:45.000000000 +0200
+++ flake-svn-2006-09-19-patched-win32-src/libflake/encode.c 2006-09-19 16:59:42.000000000 +0200
@@ -341,11 +341,7 @@
else ctx->lpc_precision = 15;
/* set maximum encoded frame size in verbatim mode */
- if(ctx->channels == 2) {
- s->max_frame_size = 14 + ((ctx->blocksize * 33 + 7) >> 3);
- } else {
- s->max_frame_size = 14 + (ctx->blocksize * ctx->channels * 2);
- }
+ s->max_frame_size = 14 + ((ctx->blocksize * ctx->channels * (ctx->bps+1)) >> 3);
ctx->max_framesize = s->max_frame_size;
/* select amount of padding to use in header */
fixes the issue. Otherwise I get:
==29220== Invalid write of size 4
==29220== at 0x409EC1: output_residual (bitio.h:103)
==29220== by 0x40A676: output_subframes (encode.c:729)
==29220== by 0x40AF62: flake_encode_frame (encode.c:801)
==29220== by 0x401F21: main (flake.c:378)
==29220== Address 0x403DAB5 is 4,237 bytes inside a block of size 4,238 alloc'd
==29220== at 0x4C2006B: malloc (vg_replace_malloc.c:149)
==29220== by 0x401EAD: main (flake.c:369)
==29220==
==29220== Invalid write of size 1
==29220== at 0x40AF76: flake_encode_frame (bitio.h:70)
==29220== by 0x401F21: main (flake.c:378)
==29220== Address 0x403DAB9 is 3 bytes after a block of size 4,238 alloc'd
==29220== at 0x4C2006B: malloc (vg_replace_malloc.c:149)
==29220== by 0x401EAD: main (flake.c:369)
==29220==
==29220== Invalid read of size 1
==29220== at 0x40B7C0: calc_crc16 (crc.c:71)
==29220== by 0x40AFC1: flake_encode_frame (encode.c:767)
==29220== by 0x401F21: main (flake.c:378)
==29220== Address 0x403DAB6 is 0 bytes after a block of size 4,238 alloc'd
==29220== at 0x4C2006B: malloc (vg_replace_malloc.c:149)
==29220== by 0x401EAD: main (flake.c:369)
==29220==
==29220== Invalid read of size 1
==29220== at 0x40B7C9: calc_crc16 (crc.c:71)
==29220== by 0x40AFC1: flake_encode_frame (encode.c:767)
==29220== by 0x401F21: main (flake.c:378)
==29220== Address 0x403DAB7 is 1 bytes after a block of size 4,238 alloc'd
==29220== at 0x4C2006B: malloc (vg_replace_malloc.c:149)
==29220== by 0x401EAD: main (flake.c:369)
==29220==
==29220== Invalid read of size 1
==29220== at 0x40B7EF: calc_crc16 (crc.c:71)
==29220== by 0x40AFC1: flake_encode_frame (encode.c:767)
==29220== by 0x401F21: main (flake.c:378)
==29220== Address 0x403DAB8 is 2 bytes after a block of size 4,238 alloc'd
==29220== at 0x4C2006B: malloc (vg_replace_malloc.c:149)
==29220== by 0x401EAD: main (flake.c:369)
==29220==
==29220== Invalid read of size 1
==29220== at 0x40B81D: calc_crc16 (crc.c:71)
==29220== by 0x40AFC1: flake_encode_frame (encode.c:767)
==29220== by 0x401F21: main (flake.c:378)
==29220== Address 0x403DAB9 is 3 bytes after a block of size 4,238 alloc'd
==29220== at 0x4C2006B: malloc (vg_replace_malloc.c:149)
==29220== by 0x401EAD: main (flake.c:369)
BTW, the svn version has been speeded up by quite some amount in conrast to last release. Some minor speed-up will be commited shortly, I think. So maybe someone likes to bench.