Skip to content

fix: resolve verifiable bugs in other-amount.ts and src-defer.ts#379

Open
bryancasler wants to merge 1 commit intomainfrom
fix/resolve-verifiable-bugs
Open

fix: resolve verifiable bugs in other-amount.ts and src-defer.ts#379
bryancasler wants to merge 1 commit intomainfrom
fix/resolve-verifiable-bugs

Conversation

@bryancasler
Copy link
Copy Markdown
Member

This PR resolves the following verifiable bugs identified during code audit by MinMax M2.5:

Bugs Fixed

  1. other-amount.ts - Invalid event type in addEventListener (HIGH)

    • Issue: String event names ('focusin', 'input') were passed directly to addEventListener() without type assertion
    • Fix: Added proper type assertion for the event parameter
  2. other-amount.ts - Potential null reference (MEDIUM)

    • Issue: lastRadioInput could be null if the selector didn't match, causing runtime error when setting .checked
    • Fix: Added null check before accessing .checked property
  3. src-defer.ts - Incorrect replaceChild arguments (CRITICAL)

    • Issue: replaceChild was passing the same element twice (copy = original), and subsequent video property modifications were applied to the removed element
    • Fix: Properly clone the video element using cloneNode(true), replace the original with the clone, and apply modifications to the cloned element

Testing

All changes compile successfully with TypeScript." 2>&1

- Fix invalid event type in addEventListener in other-amount.ts
- Add null check for lastRadioInput in other-amount.ts
- Fix replaceChild arguments in src-defer.ts to properly clone video element
@fernanDOTdo
Copy link
Copy Markdown
Member

@bryancasler Please, create a test page where we can see and understand each one of the issues and validate the solutions.
Thank you!

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