Sfoglia il codice sorgente

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.
Fabian Giesen 4 anni fa
parent
commit
0d47d17002
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      stb_vorbis.c

+ 4 - 1
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;