Browse Source

codec: webvtt: handle invalid values as specific type

refs #29533

This reverts commit 7f16b5681f.
update/opus-1.6.1
François Cartegnie 7 months ago
committed by Steve Lhomme
parent
commit
f2f449a2ed
  1. 2
      modules/codec/webvtt/CSSGrammar.y
  2. 1
      modules/codec/webvtt/css_parser.h
  3. 4
      modules/codec/webvtt/css_style.c

2
modules/codec/webvtt/CSSGrammar.y

@ -776,7 +776,7 @@ term:
| UNICODERANGE maybe_space { $$.type = TYPE_UNICODERANGE; $$.psz = $1; }
| IDSEL maybe_space { $$.type = TYPE_HEXCOLOR; $$.psz = $1; }
| HASH maybe_space { $$.type = TYPE_HEXCOLOR; $$.psz = $1; }
| '#' maybe_space { $$.type = TYPE_HEXCOLOR; $$.psz = NULL; } /* Handle error case: "color: #;" */
| '#' maybe_space { $$.type = TYPE_INVALID; } /* Handle error case: "color: #;" */
/* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */
| function {
$$ = $1;

1
modules/codec/webvtt/css_parser.h

@ -37,6 +37,7 @@ typedef struct
vlc_css_expr_t *function;
enum
{
TYPE_INVALID,
TYPE_NONE = 0,
TYPE_EMS,
TYPE_EXS,

4
modules/codec/webvtt/css_style.c

@ -175,8 +175,6 @@ void webvtt_FillStyleFromCssDeclaration( const vlc_css_declaration_t *p_decl, te
term = &p_decl->expr->seq[i].term;
if( term->type < TYPE_STRING )
continue;
if( term->type == TYPE_HEXCOLOR && term->psz == NULL) // Handle error case: "color: #;"
continue;
i_total += strlen( term->psz );
if( term->type == TYPE_STRING )
i_total += 2;
@ -190,8 +188,6 @@ void webvtt_FillStyleFromCssDeclaration( const vlc_css_declaration_t *p_decl, te
term = &p_decl->expr->seq[i].term;
if( term->type < TYPE_STRING )
continue;
if( term->type == TYPE_HEXCOLOR && term->psz == NULL) // Handle error case: "color: #;"
continue;
if( i > 0 )
strcat( psz, ", " );
i_total += strlen( term->psz );

Loading…
Cancel
Save