Skip to content

fix: OverflowException in CacheManager when reading negative IP values from SQLite#289

Open
aggus19 wants to merge 1 commit into
daffyyyy:mainfrom
aggus19:fix/sqlite-overflow-cachemanager
Open

fix: OverflowException in CacheManager when reading negative IP values from SQLite#289
aggus19 wants to merge 1 commit into
daffyyyy:mainfrom
aggus19:fix/sqlite-overflow-cachemanager

Conversation

@aggus19

@aggus19 aggus19 commented Jun 14, 2026

Copy link
Copy Markdown

Problem

SQLite stores uint values > 2,147,483,647 as negative int64. When Dapper deserializes the address column from sa_players_ips into a uint tuple field, values like -1250625110 (which represents a valid IP as uint: 3044342186) cause a System.OverflowException.

This causes:

  • Exception on every server start during InitializeCacheAsync()
  • Progressive server performance degradation (slow-motion gameplay) after 12-18 hours of uptime
  • Only fixable by server restart

Fix

Changes the query tuple type from uint to long and adds an explicit cast (uint)(value & 0xFFFFFFFF) to safely convert both positive and negative stored values back to the correct uint representation.

Affected users

SQLite users with IP addresses in the upper half of the uint range (IPs > 128.x.x.x), which is the majority of public IPs.

Testing

Tested on 4 production servers running CS2-SimpleAdmin 1.7.9a with CSS 1.0.369. The OverflowException no longer occurs on startup and servers maintain stable performance over extended periods.

…s from SQLite

SQLite stores uint values > 2,147,483,647 as negative int64. When Dapper
deserializes the address column from sa_players_ips into a uint tuple field,
values like -1250625110 (which represents a valid IP as uint: 3044342186)
cause a System.OverflowException.

This fix changes the query tuple type from uint to long and adds an explicit
cast (uint)(value & 0xFFFFFFFF) to safely convert both positive and negative
stored values back to the correct uint representation.

Affects: SQLite users with IP addresses in the upper half of the uint range
(IPs > 128.x.x.x)
@aggus19 aggus19 force-pushed the fix/sqlite-overflow-cachemanager branch from 590a841 to a7f66c0 Compare June 15, 2026 02:58
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.

1 participant