Alex Dale 380148e3e6 Fixed HLS parsing of bad content IDs.
[ Merge of http://go/wvgerrit/207457 ]

When parsing Widevine's HLS key data, the key details are contained
in a data URI in the HLS X-KEY URI field.  The data of the URI is a
base64 encoded JSON object, containing the information required to
generate the license request.  The "content_id" field of the JSON
object is expected to be a base64 encoded; however, the HLS parser
did not verify that the decoding was successful.  In the event that
was not successful, the decoder would return an empty string, which
the parser would attempt to access the first element by reference
which may be a null reference.

In C++, creating a reference from a null point (without actually
accessing the value) is undefined; however most C++ implemenations
will not cause a segment fault; but it is not guarenteed by the
standard.

This change checks if the decoding was successful before attempting
to store the decoded "content_id" value.

A unit test is added to ensure that a parser fails gracefully.

Bug: 356210640
Test: HlsParseTest.BadHlsData_InvalidContentId
Change-Id: Ie2ad42d69953258659178dd1464d830b2723c6c7
2024-10-01 21:14:19 -07:00
2020-02-12 14:36:45 -08:00
2014-02-20 12:48:45 -08:00
2023-03-27 02:45:01 +00:00
2022-04-22 16:35:07 +00:00
Description
No description provided
1.1 GiB