From be90aa4f46645a2f80bb193c08e5dbb96722f92f Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 4 Jul 2026 13:23:37 +0200 Subject: [PATCH] Use the `MathClamp` helper in the `PDFImage.prototype.getComponents` method --- src/core/image.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/image.js b/src/core/image.js index 8aa2ae280..8861461d2 100644 --- a/src/core/image.js +++ b/src/core/image.js @@ -579,13 +579,7 @@ class PDFImage { } const remainingBits = bits - bpc; - let value = buf >> remainingBits; - if (value < 0) { - value = 0; - } else if (value > max) { - value = max; - } - output[i] = value; + output[i] = MathClamp(buf >> remainingBits, 0, max); buf &= (1 << remainingBits) - 1; bits = remainingBits; }