Skip to content

[BUG] : Unescaped Search Query Special Characters Regex Exception in SpeechHistory #1189

Description

@hrshjswniii

🚀 Program

GSSoC

🐛 Describe the bug

In SpeechHistory.jsx, when users filter their speech history using the search bar, entering regex special characters (such as (, [, *, +, ?, \) without sanitization into a new RegExp(query, "i") constructor throws a fatal SyntaxError: Invalid regular expression crash, breaking the speech history rendering view.


🔁 Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to the Speech History drawer or page.
  2. Type ( or [ in the search input box.
  3. See error with white screen or SyntaxError: Invalid regular expression in DevTools console.

✅ Expected Behavior

Search queries should escape special regex characters or perform case-insensitive String.prototype.includes() matching to prevent regex syntax crashes.


❌ Actual Behavior

Typing special regex characters into the search bar throws a unhandled SyntaxError exception that crashes the history panel.


🌱 Contributor Checklist

  • I am participating via GSSoC
  • I have read the contribution guidelines
  • I checked for existing issues before creating this

💻 Environment

  • Browser: Chrome, Firefox, Edge, Safari
  • Device: Desktop, Laptop
  • OS: Windows, macOS, Linux

📝 Additional Context

Replacing new RegExp() with sanitized string escaping or text.toLowerCase().includes(query.toLowerCase()) fixes the search crash.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions