Skip to content

Commit

Permalink
WebCodecs AV1 codec string validation is buggy
Browse files Browse the repository at this point in the history
rdar://122084515
https://bugs.webkit.org/show_bug.cgi?id=268538

Reviewed by Eric Carlson.

We just validate the profile so just need to ensure it is there.
We fix the length check and add a '.' check.

Covered by AV1 test running on devices with AV1 decoders.

* Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::validateCodecString):

Canonical link: https://commits.webkit.org/274089@main
  • Loading branch information
youennf committed Feb 5, 2024
1 parent c00a65b commit f3073fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,11 @@ static bool validateCodecString(VideoCodecType codecType, const String& codecStr
ASSERT(codecString.startsWith("vp09.0"_s));
return true;
case VideoCodecType::AV1:
if (codecString.startsWith("av01."_s) && codecString.length() > 7)
ASSERT(codecString.startsWith("av01."_s));
if (!codecString.startsWith("av01."_s) || codecString.length() < 7)
return false;
auto profile = codecString[5];
return profile == '0' || profile == '1' || profile == '2';
return (profile == '0' || profile == '1' || profile == '2') && codecString[6] == '.';
}
ASSERT_NOT_REACHED();
return true;
Expand Down

0 comments on commit f3073fb

Please sign in to comment.