Split NULL out param from zero outl. Return -1 on malloc failure and
NULL parameter. Keep 0 only for outl <= 0 and clean EOF. This lets
callers distinguish errors from empty reads without inspecting the
error queue.
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/28908)
(cherry picked from commit
5871953822fb02bb651abf60dfc4a0785a5a3caa)
(cherry picked from commit
ff05645178049316e5aa53d665bf5c0e05eef08c)
(cherry picked from commit
7607b9a1700ec0f2cab6b3f46ec8bfbf3d546e66)
ZSTD_outBuffer outBuf;
BIO *next = BIO_next(b);
- if (out == NULL || outl <= 0)
+ if (out == NULL) {
+ ERR_raise(ERR_LIB_COMP, ERR_R_PASSED_NULL_PARAMETER);
+ return -1;
+ }
+ if (outl <= 0)
return 0;
ctx = BIO_get_data(b);
ctx->decompress.buffer = OPENSSL_malloc(ctx->decompress.bufsize);
if (ctx->decompress.buffer == NULL) {
ERR_raise(ERR_LIB_COMP, ERR_R_MALLOC_FAILURE);
- return 0;
+ return -1;
}
ctx->decompress.inbuf.src = ctx->decompress.buffer;
ctx->decompress.inbuf.size = 0;