Hello, there! :)

My colleague Nedelcho Stanev and myself have identified what we would
think to be a bug (or a flaw) in the EVP_DecodeUpdate() routine. We
were trying to read base64 encoded data with the base64 BIO which has
the 'next' member pointed to membuf BIO in which we write the encoded
data. So far so good ... Eventually it turned up that some of the data
we pass to the BIO chain is properly decoded while other not - or more
properly would be to say - partially decoded. We tried to debug the
problem and here is what we have found:

The EVP_DecodeUpdate() routine errnously returns 0 (EOF) if the buffer
passed it, ends with CRLF and EVP_DecodeBlock() has just processed
the data upto the ending CRLF.

Attached is a patch and a testcase. I tried to follow the coding style
and to make the change not intrusive :) though its a very small change
:)

Here is how to reproduce:

1. Base64 encode a file lets say > 200kb
2. unix2dos the output
3. Use the attached testcase to decode the file

Attachment: encode.c.patch
Description: Binary data

Attachment: bio.cpp
Description: Binary data

Reply via email to