See https://trac.xiph.org/ticket/1209 for the bug report. This patch comes from: https://trac.xiph.org/changeset/13263?format=diff&new=13263 Index: /trunk/vorbis-tools/oggdec/oggdec.c =================================================================== --- vorbis-tools/oggdec/oggdec.c (revision 12221) +++ vorbis-tools/oggdec/oggdec.c (revision 13263) @@ -256,4 +256,5 @@ int bs = 0; char buf[8192], outbuf[8192]; + char *p_outbuf; int buflen = 8192; unsigned int written = 0; @@ -325,7 +326,11 @@ /* Then permute! */ permute_channels(buf, outbuf, ret, channels, bits/8); - } - - if(fwrite(outbuf, 1, ret, out) != ret) { + p_outbuf = outbuf; + } + else { + p_outbuf = buf; + } + + if(fwrite(p_outbuf, 1, ret, out) != ret) { fprintf(stderr, "Error writing to file: %s\n", strerror(errno)); ov_clear(&vf);