tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 59a21d243c628cb8e64ff59647d994715b255e5d
parent 150f1e1c4280365b38c159a53f70d8ed089a13bb
Author: Paul Adenot <paul@paul.cx>
Date:   Thu, 11 Dec 2025 10:35:24 +0000

Bug 2005116 - Handle infinity and nan floats before converting linear to db in DynamicsCompressorKernel.cpp. r=karlt,media-playback-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D275781

Diffstat:
Mdom/media/test/crashtests/crashtests.list | 1+
Adom/media/test/crashtests/dynamics-compressor-extreme-value.html | 14++++++++++++++
Mdom/media/webaudio/blink/DynamicsCompressorKernel.cpp | 6++++++
3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/dom/media/test/crashtests/crashtests.list b/dom/media/test/crashtests/crashtests.list @@ -189,3 +189,4 @@ load 1917627.mp4 skip-if(Android) load audioworkletprocessor-recursion.html load 1987790.webm load 1999307.html +load dynamics-compressor-extreme-value.html diff --git a/dom/media/test/crashtests/dynamics-compressor-extreme-value.html b/dom/media/test/crashtests/dynamics-compressor-extreme-value.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<script> + window.addEventListener("load", async () => { + const ctx = new OfflineAudioContext(12, 1024, 48000); + const a = new DynamicsCompressorNode(ctx); + const b = new ConstantSourceNode(ctx, {"offset": 7.574213933350201e+37}); + b.connect(a, 0, 0); + b.start(0); + await ctx.startRendering(); + document.documentElement.classList.remove("reftest-wait"); + }); +</script> +</html> diff --git a/dom/media/webaudio/blink/DynamicsCompressorKernel.cpp b/dom/media/webaudio/blink/DynamicsCompressorKernel.cpp @@ -410,6 +410,12 @@ void DynamicsCompressorKernel::process( float attenuation = absInput <= 0.0001f ? 1 : shapedInput / absInput; + if (std::isnan(attenuation)) { + // When absInput is inf, shapedInput is also inf, so attenuation is + // NaN. Use maximum attenuation. + attenuation = 0; + } + float attenuationDb = -WebAudioUtils::ConvertLinearToDecibels(attenuation, -1000.0f); attenuationDb = std::max(2.0f, attenuationDb);