Skip to content

Fix TypeError in nouveau for stored index types#5952

Open
vamsi2246 wants to merge 2 commits intoapache:mainfrom
vamsi2246:fix-nouveau-typeerror
Open

Fix TypeError in nouveau for stored index types#5952
vamsi2246 wants to merge 2 commits intoapache:mainfrom
vamsi2246:fix-nouveau-typeerror

Conversation

@vamsi2246
Copy link
Copy Markdown

This PR fixes a string interpolation bug in nouveau.js where the raw data payload (value) was inadvertently concatenated into the runtime TypeError string when catching invalid 'stored' index types. Instead of evaluating to a confusing literal message or risking huge allocations, it now securely statically logs the parameter's variable name alongside typeof value.

This PR fixes a string interpolation bug in nouveau.js where the raw data payload (value) was inadvertently concatenated into the runtime TypeError string when catching invalid 'stored' index types. Instead of evaluating to a confusing literal message or risking huge allocations, it now securely statically logs the parameter's variable name alongside typeof value.
@vamsi2246 vamsi2246 force-pushed the fix-nouveau-typeerror branch from f1263f5 to 90a2059 Compare March 29, 2026 09:07
@vamsi2246 vamsi2246 changed the title fix(nouveau): securely format TypeError exception for invalid stored values Fix TypeError in nouveau for stored index types Mar 29, 2026
var value = arguments[2];
if (typeof value != 'number' && typeof value != 'string') {
throw ({ name: 'TypeError', message: 'type of ' + value + ' must be a string or number' });
throw ({ name: 'TypeError', message: 'type of value must be a string or number not ' + typeof value });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! I think we should include name in this string too, so that an error reads type of 'foo' must be a string or number not object for example. so name where value previous was but keep the typeof value at the end?

@rnewson
Copy link
Copy Markdown
Member

rnewson commented Mar 30, 2026

Also, our pull request template is not optional. Please restore it and complete it honestly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants