sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: "Måns Rullgård" <mans@mansr.com>
Cc: "Guido Günther" <agx@sigxcpu.org>, sox-devel@lists.sourceforge.net
Subject: [PATCH RESEND 5/9] Handle vorbis_analysis_headerout errors
Date: Fri, 31 Jul 2020 09:37:57 +0000	[thread overview]
Message-ID: <20200731093801.23548-6-normalperson@yhbt.net> (raw)
In-Reply-To: <20200731093801.23548-1-normalperson@yhbt.net>

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

  parent reply	other threads:[~2020-07-31  9:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31  9:37 [PATCH RESEND 0/9] some old accumulated patches Eric Wong
2020-07-31  9:37 ` [PATCH RESEND 1/9] use non-blocking stdin for interactive mode Eric Wong
2020-07-31  9:37 ` [PATCH RESEND 2/9] speed up "|program" inputs on Linux 2.6.35+ Eric Wong
2020-07-31 10:53   ` Måns Rullgård
2020-07-31  9:37 ` [PATCH RESEND 3/9] sox.1: fix section name Eric Wong
2020-07-31  9:37 ` [PATCH RESEND 4/9] sndio: handle 24-bit samples properly on OpenBSD Eric Wong
2020-07-31 10:59   ` Måns Rullgård
2020-07-31  9:37 ` Eric Wong [this message]
2020-07-31  9:37 ` [PATCH RESEND 6/9] fix manpage warning: "table wider than line width" Eric Wong
2020-07-31  9:37 ` [PATCH RESEND 7/9] spectrogram: remove arbitrary limit on height of spectrogram Eric Wong
2020-07-31 14:34   ` Måns Rullgård
     [not found]     ` <CAL4-wQpF-qOD=BRVPhgZFC7fjvFDV-rQx1stvwY_xCTyj5uooA@mail.gmail.com>
2020-08-13 16:20       ` Måns Rullgård
2020-08-13 16:30         ` Pander via SoX-devel
2020-08-13 16:38           ` Måns Rullgård
2020-07-31  9:38 ` [PATCH RESEND 8/9] Add spectrogram -n flag to normalise the output to maximum brightness Eric Wong
2020-07-31  9:38 ` [PATCH RESEND 9/9] Added average power spectrum for stat -freq -a Eric Wong
2020-08-01 11:52   ` Måns Rullgård
2020-08-02  1:03     ` Eric Wong
2020-08-02 10:43       ` Måns Rullgård
2020-08-02 10:52     ` Måns Rullgård
2020-08-03 12:44       ` Pander via SoX-devel
2020-08-03 13:41         ` Måns Rullgård
2020-07-31 10:13 ` [PATCH RESEND 0/9] some old accumulated patches Måns Rullgård
2020-07-31 21:16   ` Eric Wong
2020-07-31 21:44     ` Måns Rullgård
2020-08-01 16:57 ` Måns Rullgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200731093801.23548-6-normalperson@yhbt.net \
    --to=sox-devel@lists.sourceforge.net \
    --cc=agx@sigxcpu.org \
    --cc=mans@mansr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).