ref: 04e064ce856a22e011dab8f41098966f2fe9700d
parent: 5ed1edc8dfe52f5d8f788330558ed2e6e8bee5f7
author: Guido Günther <agx@sigxcpu.org>
date: Wed Nov 15 13:36:58 EST 2017
vorbis: handle vorbis_analysis_headerout errors This is related to https://github.com/xiph/vorbis/pull/34 but could also happen today with on other errors in the called function.
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -270,8 +270,11 @@
vc.comment_lengths[i] = strlen(text);
}
}
- vorbis_analysis_headerout( /* Build the packets */
- &ve->vd, &vc, &header_main, &header_comments, &header_codebooks);
+ if (vorbis_analysis_headerout( /* Build the packets */
+ &ve->vd, &vc, &header_main, &header_comments, &header_codebooks) < 0) {
+ ret = HEADER_ERROR;
+ goto cleanup;
+ }
ogg_stream_packetin(&ve->os, &header_main); /* And stream them out */
ogg_stream_packetin(&ve->os, &header_comments);
@@ -280,6 +283,7 @@
while (ogg_stream_flush(&ve->os, &ve->og) && ret == HEADER_OK)
if (!oe_write_page(&ve->og, ft))
ret = HEADER_ERROR;
+cleanup:
for (i = 0; i < vc.comments; ++i)
free(vc.user_comments[i]);
free(vc.user_comments);