Repository navigation
Fix NaN handling in responseAdSlotCount - #1254
pavankumar-vh wants to merge 1 commit into
Conversation
The function didn't validate that params.step and params.firstAdAfterNodes are finite numbers. If they were NaN or Infinity, Math.max(1, NaN) would return NaN. Added Number.isFinite() checks to default to safe values for invalid numbers.
|
Good catch on the NaN propagation issue — A few gaps though:
The core idea is right and worth porting, but as-is it fixes half the surface area of the bug it identifies and has no test coverage. Please extend the guard to |
|
Marking this stale - there has been no activity here for 29 days. It will close in 7 days unless someone comments. This is backlog upkeep, not a verdict on the pull request. A single comment keeps it open, and anything closed this way can be reopened. |
Overview
Fix NaN handling in the
responseAdSlotCountfunction incommon/src/util/response-ad-positions.ts.Bug Description
The function didn't validate that params.step and params.firstAdAfterNodes are finite numbers. If they were NaN or Infinity,
Math.max(1, NaN)would return NaN.Fix
Added
Number.isFinite()checks to default to safe values for invalid numbers.Testing
No existing tests for this function, but the fix prevents incorrect behavior with invalid inputs.
Files Changed
common/src/util/response-ad-positions.ts- Added NaN validationScope
This change only touches
common/which is an approved contribution area per the Contributing Guide.