Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.96.7 (unreleased)
-------------------
- Fix: Remove strdup() memory leaks in WebVTT styling encoder, fix invalid CSS rgba(0,256,0) green value, fix missing free(unescaped) on write-error path (#2154)
- Fix: Prevent crash in Rust timing module when logging out-of-range PTS/FTS timestamps from malformed streams.

0.96.6 (2026-02-19)
Expand Down
15 changes: 8 additions & 7 deletions src/lib_ccx/ccx_encoders_webvtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static const char *webvtt_inline_css = "\r\nSTYLE\n\n"
" background-color: rgba(255, 255, 255, 0.5);\n"
"}\n"
"::cue(c.bg_green.bg_semi-transparent) {\n"
" background-color: rgba(0, 256, 0, 0.5);\n"
" background-color: rgba(0, 255, 0, 0.5);\n"
"}\n"
"::cue(c.bg_blue.bg_semi-transparent) {\n"
" background-color: rgba(0, 0, 255, 0.5);\n"
Expand Down Expand Up @@ -189,6 +189,7 @@ int write_stringz_as_webvtt(char *string, struct encoder_ctx *context, LLONG ms_
if (written != context->encoded_crlf_length)
{
free(el);
free(unescaped);
return -1;
}
begin += strlen((const char *)begin) + 1;
Expand Down Expand Up @@ -502,16 +503,16 @@ int write_cc_buffer_as_webvtt(struct eia608_screen *data, struct encoder_ctx *co
if (open_font != FONT_REGULAR)
{
if (open_font & FONT_ITALICS)
write_wrapped(context->out->fh, strdup("<i>"), 3);
write_wrapped(context->out->fh, "<i>", 3);
if (open_font & FONT_UNDERLINED)
write_wrapped(context->out->fh, strdup("<u>"), 3);
write_wrapped(context->out->fh, "<u>", 3);
}

// opening events for colors
int open_color = color_events[j] & 0xFF; // Last 16 bytes
if (open_color != COL_WHITE)
{
write_wrapped(context->out->fh, strdup("<c."), 3);
write_wrapped(context->out->fh, "<c.", 3);
write_wrapped(context->out->fh, color_text[open_color][0], strlen(color_text[open_color][0]));
write_wrapped(context->out->fh, ">", 1);
}
Expand All @@ -532,17 +533,17 @@ int write_cc_buffer_as_webvtt(struct eia608_screen *data, struct encoder_ctx *co
int close_color = color_events[j] >> 16; // First 16 bytes
if (close_color != COL_WHITE)
{
write_wrapped(context->out->fh, strdup("</c>"), 4);
write_wrapped(context->out->fh, "</c>", 4);
}

// closing events for fonts
int close_font = font_events[j] >> 16; // First 16 bytes
if (close_font != FONT_REGULAR)
{
if (close_font & FONT_UNDERLINED)
write_wrapped(context->out->fh, strdup("</u>"), 4);
write_wrapped(context->out->fh, "</u>", 4);
if (close_font & FONT_ITALICS)
write_wrapped(context->out->fh, strdup("</i>"), 4);
write_wrapped(context->out->fh, "</i>", 4);
}
}
}
Expand Down
Loading