{"record":{"id":"07452952199829a8","repo":"mozilla/pdf.js","slug":"invalid-whitepoint-components-no-fallback-availab","errorCode":null,"errorMessage":"Invalid WhitePoint components, no fallback available","messagePattern":"Invalid WhitePoint components, no fallback available","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/colorspace.js","lineNumber":1223,"sourceCode":"\n    if (!whitePoint) {\n      throw new FormatError(\n        \"WhitePoint missing - required for color space Lab\"\n      );\n    }\n    // Translate args to spec variables\n    [this.XW, this.YW, this.ZW] = whitePoint;\n    [this.amin, this.amax, this.bmin, this.bmax] = range || [\n      -100, 100, -100, 100,\n    ];\n\n    // These are here just for completeness - the spec doesn't offer any\n    // formulas that use BlackPoint in Lab\n    [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];\n\n    // Validate vars as per spec\n    if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {\n      throw new FormatError(\n        \"Invalid WhitePoint components, no fallback available\"\n      );\n    }\n\n    if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {\n      info(\"Invalid BlackPoint, falling back to default\");\n      this.XB = this.YB = this.ZB = 0;\n    }\n\n    if (this.amin > this.amax || this.bmin > this.bmax) {\n      info(\"Invalid Range, falling back to defaults\");\n      this.amin = -100;\n      this.amax = 100;\n      this.bmin = -100;\n      this.bmax = 100;\n    }\n  }\n","sourceCodeStart":1205,"sourceCodeEnd":1241,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/colorspace.js#L1205-L1241","documentation":"Thrown by LabCS when WhitePoint fails spec validation: XW < 0, ZW < 0, or YW !== 1. The check mirrors CalGray/CalRGB; BlackPoint and Range have fallbacks but WhitePoint does not, so an invalid value is unrecoverable.","triggerScenarios":"A /Lab /WhitePoint array with negative X or Z, or whose Y component is not 1.","commonSituations":"Malformed Lab WhitePoint from a broken color-management pipeline; hand-authored PDF; rounding leaving Y != 1.","solutions":["Repair the PDF so /WhitePoint has non-negative X/Z and Y exactly 1.","Update pdf.js.","When generating PDFs, normalize WhitePoint to Y=1."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isValidWhitePoint(wp) {\n  return Array.isArray(wp)\n    && wp.length === 3\n    && wp[0] >= 0\n    && wp[1] === 1\n    && wp[2] >= 0;\n}","tryCatchPattern":"try {\n  cs = ColorSpace.parse(res, xref, cs, pdfFunctionFactory);\n} catch (e) {\n  if (e instanceof FormatError && /Invalid WhitePoint components/.test(e.message)) {\n    console.warn('Invalid Lab WhitePoint, falling back', e);\n    cs = null;\n  } else throw e;\n}","preventionTips":["When generating /Lab color spaces, normalize /WhitePoint so Y = 1 and X, Z >= 0.","Validate untrusted PDFs before rendering.","Keep pdf.js updated.","Fall back to a default colorspace when Lab construction fails."],"tags":["colorspace","lab","cie","validation","pdf"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}