{"record":{"id":"68ccd1bc22210e0f","repo":"mozilla/pdf.js","slug":"invalid-whitepoint-components-for-this-name-no","errorCode":null,"errorMessage":"Invalid WhitePoint components for ${this.name}, no fallback available","messagePattern":"Invalid WhitePoint components for (.+?), no fallback available","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/colorspace.js","lineNumber":828,"sourceCode":" * The default color is `new Float32Array([0])`.\n */\nclass CalGrayCS extends ColorSpace {\n  constructor(whitePoint, blackPoint, gamma) {\n    super(\"CalGray\", 1);\n\n    if (!whitePoint) {\n      throw new FormatError(\n        \"WhitePoint missing - required for color space CalGray\"\n      );\n    }\n    // Translate arguments to spec variables.\n    [this.XW, this.YW, this.ZW] = whitePoint;\n    [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];\n    this.G = gamma || 1;\n\n    // Validate variables as per spec.\n    if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {\n      throw new FormatError(\n        `Invalid WhitePoint components for ${this.name}, no fallback available`\n      );\n    }\n\n    if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {\n      info(`Invalid BlackPoint for ${this.name}, falling back to default.`);\n      this.XB = this.YB = this.ZB = 0;\n    }\n\n    if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {\n      warn(\n        `${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` +\n          `ZB: ${this.ZB}, only default values are supported.`\n      );\n    }\n\n    if (this.G < 1) {\n      info(","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/colorspace.js#L810-L846","documentation":"Thrown by CalGrayCS when the WhitePoint fails spec validation: XW < 0, ZW < 0, or YW !== 1. WhitePoint must be a CIE-relative white with Y normalized to 1; BlackPoint and gamma have fallbacks but WhitePoint does not, so an invalid one is fatal.","triggerScenarios":"A /CalGray /WhitePoint array whose X or Z component is negative, or whose Y component is not exactly 1 (e.g. [0.95, 0.98, 1.08]).","commonSituations":"Color-managed PDF with a malformed ICC-derived WhitePoint; hand-authored PDF; rounding that left Y != 1.","solutions":["Repair the PDF so /WhitePoint has non-negative X/Z and Y exactly 1.","Update pdf.js.","If you generate PDFs, normalize the white point to Y=1 before writing."],"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 CalGray WhitePoint, falling back', e);\n    cs = null;\n  } else throw e;\n}","preventionTips":["When generating /CalGray color spaces, normalize /WhitePoint so Y = 1 and X, Z >= 0.","Validate untrusted PDFs before rendering.","Keep pdf.js updated.","Treat colorspace failures as non-fatal where rendering can proceed."],"tags":["colorspace","calgray","cie","validation","pdf"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}