[prev in list] [next in list] [prev in thread] [next in thread]
List: sox-devel
Subject: [SoX-devel] [PATCH RESEND 5/9] Handle vorbis_analysis_headerout errors
From: Eric Wong <normalperson () yhbt ! net>
Date: 2020-07-31 9:37:57
Message-ID: 20200731093801.23548-6-normalperson () yhbt ! net
[Download RAW message or body]
From: Guido Günther <agx@sigxcpu.org>
This is related to
https://github.com/xiph/vorbis/pull/34
but could also happen today with on other errors in the called function.
---
src/vorbis.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/vorbis.c b/src/vorbis.c
index aafce7e2..9fa234ce 100644
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -270,8 +270,11 @@ static int write_vorbis_header(sox_format_t * ft, vorbis_enc_t * ve)
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 @@ static int write_vorbis_header(sox_format_t * ft, vorbis_enc_t * ve)
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);
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic