"David E. Wheeler" <david@kineticode.com> writes:
> What's even weirder is that it can not work and then suddenly work:
Smells like uninitialized-memory problems to me. Perhaps you are
miscalculating the length of the input data?
Are you testing in an --enable-cassert build? The memory clobber
stuff can help to make it more obvious where such problems lurk.
regards, tom lane