Commit 369544c609 for ffmpeg
commit 369544c6090f938a4e2b6b642071e8aad18a2f20
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Wed Nov 11 18:56:11 2026 +0100
avformat/httpcookie: ignore Expires without a valid date and empty Domain attributes
They replaced a valid Expires or Domain given earlier in the cookie, which
then did not expire or was no longer sent to the hosts of its Domain.
Fixes: cookies with a second, invalid Expires or Domain
diff --git a/libavformat/httpcookie.c b/libavformat/httpcookie.c
index fa546cefdc..ef90c400c0 100644
--- a/libavformat/httpcookie.c
+++ b/libavformat/httpcookie.c
@@ -166,6 +166,11 @@ int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDi
// an invalid Max-Age is ignored (RFC 6265 5.2.2)
if (!av_strcasecmp(param, "max-age") && (!value || !is_delta_seconds(value)))
continue;
+ // an Expires without a valid date and an empty Domain are ignored (RFC 6265 5.2.1, 5.2.3)
+ if (!av_strcasecmp(param, "expires") && (!value || ff_http_parse_date(value, &(struct tm){ 0 }) < 0))
+ continue;
+ if (!av_strcasecmp(param, "domain") && (!value || !*value))
+ continue;
if (*param)
ret = av_dict_set(attributes, param, value ? value : "", 0);
}