From 0d47d17002a532fa6dc118b4c95c95e557ac7ef3 Mon Sep 17 00:00:00 2001 From: Fabian Giesen Date: Sun, 4 Jul 2021 19:26:31 -0700 Subject: [PATCH] stb_vorbis: Set error on open_memory with NULL data "Unexpected EOF" seems like the closest match from the error codes we have. Fixes issue #1123. --- stb_vorbis.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index 7c0e9cd..51e8eec 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -5100,7 +5100,10 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc) { stb_vorbis *f, p; - if (data == NULL) return NULL; + if (!data) { + if (error) *error = VORBIS_unexpected_eof; + return NULL; + } vorbis_init(&p, alloc); p.stream = (uint8 *) data; p.stream_end = (uint8 *) data + len;