diff --git a/src/artifacts/mediaAsset/MediaAssetLayouts.ts b/src/artifacts/mediaAsset/MediaAssetLayouts.ts index 4a2c6c67d4..0f0cbf2b54 100644 --- a/src/artifacts/mediaAsset/MediaAssetLayouts.ts +++ b/src/artifacts/mediaAsset/MediaAssetLayouts.ts @@ -14,7 +14,7 @@ import type { VulkanPipelineCacheMetadata, } from "../../domain/formatMetadata/mediaAssetMetadata.js"; import { BinaryReader } from "../../domain/binaryContainer.js"; -import { decodeStrictUtf8 } from "../../domain/strictUtf8.js"; +import { decodeUtf8PreservingBomOrNull } from "../../domain/strictUtf8.js"; import type { MediaAssetReaderLimits } from "../../domain/artifactReaderLimits.js"; import { artifactReaderLimitFailure } from "../../resources/index.js"; import { byteToHex } from "../../kernel/byteToHex.js"; @@ -384,17 +384,15 @@ export const oggOpusLayout = async ( limitations.push( `The OpusTags vendor string declares ${String(vendorLength)} bytes, but only ${String(tagsPrefix.length - 12)} were examined; the vendor was not read.`, ); - else - try { - vendor = decodeStrictUtf8( - tagsPrefix.subarray(12, 12 + vendorLength), - "preserve", - ); - } catch { + else { + vendor = decodeUtf8PreservingBomOrNull( + tagsPrefix.subarray(12, 12 + vendorLength), + ); + if (vendor === null) limitations.push( "The OpusTags vendor string is not valid UTF-8, which RFC 7845 requires; the vendor fact was omitted.", ); - } + } } }