[FFmpeg-cvslog] subviewer: sanitize packets.

Michael Niedermayer michaelni at gmx.at
Sun Jan 6 03:51:58 CET 2013


On Thu, Jan 03, 2013 at 07:30:21AM +0100, Clément Bœsch wrote:
> ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Thu Jan  3 07:25:45 2013 +0100| [3fa642d60f428a36413498a191eb2ee319fe4445] | committer: Clément Bœsch
> 
> subviewer: sanitize packets.
> 
> The data does not contain timing or trailing line breaks anymore. In
> addition to being less idiotic, it is consistent with other codecs and
> thus allows more switches between formats and codecs. It also fixes the
> issue of the trailing line returns being simple \n instead of CRLF in
> the ASS rectangle dialogue (this is the reason of the FATE update).
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3fa642d60f428a36413498a191eb2ee319fe4445
> ---
> 
>  libavcodec/subviewerdec.c    |   15 ++++++++++-----
>  libavcodec/version.h         |    2 +-
>  libavformat/subviewerdec.c   |   35 +++++++++++++++++++++++------------
>  libavformat/version.h        |    2 +-
>  tests/ref/fate/sub-subviewer |    2 +-
>  5 files changed, 36 insertions(+), 20 deletions(-)
> 
> diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c
> index 0e8be90..7580cbe 100644
> --- a/libavcodec/subviewerdec.c
> +++ b/libavcodec/subviewerdec.c
> @@ -31,17 +31,13 @@
>  static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
>  {
>      while (*p) {
> -        char c;
> -
> -        if (sscanf(p, "%*u:%*u:%*u.%*u,%*u:%*u:%*u.%*u%c", &c) == 1)
> -            p += strcspn(p, "\n") + 1;
>          if (!strncmp(p, "[br]", 4)) {
>              av_bprintf(buf, "\\N");
>              p += 4;
>          } else {
>              if (p[0] == '\n' && p[1])
>                  av_bprintf(buf, "\\N");
> -            else if (*p != '\r')
> +            else if (*p != '\n' && *p != '\r')
>                  av_bprint_chars(buf, *p, 1);
>              p++;
>          }
> @@ -54,10 +50,19 @@ static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
>  static int subviewer_decode_frame(AVCodecContext *avctx,
>                                    void *data, int *got_sub_ptr, AVPacket *avpkt)
>  {
> +    char c;
>      AVSubtitle *sub = data;
>      const char *ptr = avpkt->data;
>      AVBPrint buf;
>  
> +    /* To be removed later */
> +    if (sscanf(ptr, "%*u:%*u:%*u.%*u,%*u:%*u:%*u.%*u%c", &c) == 1) {

you derefernce ptr here while a few lines later there is a ptr"==NULL"
check
(CID966647)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20130106/4c7872af/attachment.asc>


More information about the ffmpeg-cvslog mailing list