Skip to content

fix: clamp page to minimum 1 in search pagination#388

Closed
wowitsjack wants to merge 1 commit intoFredolx:mainfrom
wowitsjack:fix/sql-page-offset-clamp
Closed

fix: clamp page to minimum 1 in search pagination#388
wowitsjack wants to merge 1 commit intoFredolx:mainfrom
wowitsjack:fix/sql-page-offset-clamp

Conversation

@wowitsjack
Copy link

@wowitsjack wowitsjack commented Mar 7, 2026

Full source available at FredTV-Next, my personal fork with all features integrated.

Summary

  • When filters.page is 0, the u16 offset calculation underflows (0 * PAGE_SIZE - PAGE_SIZE wraps to a large value)
  • Clamp page to minimum 1 before the calculation in all 4 search functions (search, search_series, search_hidden, search_group)

Test plan

  • Search for channels with page=0 in filters, verify no panic or unexpected results
  • Normal pagination continues to work correctly

@CLAassistant
Copy link

CLAassistant commented Mar 7, 2026

CLA assistant check
All committers have signed the CLA.

When filters.page is 0, the u16 offset calculation underflows
(0 * PAGE_SIZE - PAGE_SIZE wraps to a large value). Clamp page
to minimum 1 before the calculation in all 4 search functions.
@wowitsjack wowitsjack force-pushed the fix/sql-page-offset-clamp branch from c12d234 to 5cd192f Compare March 7, 2026 00:38
@wowitsjack
Copy link
Author

wowitsjack commented Mar 7, 2026

Agreed

@wowitsjack wowitsjack force-pushed the fix/sql-page-offset-clamp branch 2 times, most recently from 1e4a7d6 to 5cd192f Compare March 7, 2026 15:54
@wowitsjack
Copy link
Author

Superseded by #396 + #397 which contribute the full FredTV-Next codebase as a proper 2-part stack.

@wowitsjack wowitsjack closed this Mar 7, 2026
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