Skip to content

quotedString should verify a string is in fact quoted

This is a fairly minor issue, but can complicate troubleshooting when a user makes a non-obvious mistake in their HLS manifest.

If a user has an m3u8 like this

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-KEY:METHOD=AES-128,URI=small.mp4.key

(note the lack of quotes on the value of URI) then the request VLC makes to their webserver/filesystem will be for mall.mp4.ke

This is because (in 3.0.8) the URI has quotedString() called on it in modules/demux/hls/playlist/Parser.cpp on line 286.

quotedString (defined in modules/demux/hls/playlist/Tags.cpp on line 119) doesn't check for the presence of quotes and just drops the first and last char

std::istringstream is(value.substr(1, value.length() - 2));

Although the HLS spec requires that URI be quoted, older versions of VLC handled this more gracefully.

Weatherwax (2.2.2) had an explicit check for quotes (in modules/stream_filter/httplive.c on line 836) and removed only if present

/* Url is put between quotes, remove them */
if (*value == '"')
{
    /* We need to strip the "" from the attribute value */
    uri = value + 1;
    char* end = strchr(uri, '"');
    if (end != NULL)
        *end = 0;
}

Although it only affects non-compliant streams, it seems quotedString() probably should verify that the string it's been passed is in fact quoted.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information