What's Changed
Fix arithmetic overflow crash in request pagination by @petrpavlik in #637
When paging request, providing large values for
page
andper
params will cause an arithmetic overflow exception and crash the processFixes a crash where trying to paginate with values that when multiplied cause an arithmetic overflow exception and crash the process. Following added unit tests provides an example.
func testPaginationDoesntCrashOnOverflow() throws { let db = DummyDatabaseForTestSQLSerializer() let pageRequest1 = PageRequest(page: 1184467440737095516, per: 1184467440737095516) db.fakedRows.append([.init(["aggregate": 1])]) // This would crash on `Swift runtime failure: arithmetic overflow` if not handled // so no point trying any XCTAssert _ = try Planet2 .query(on: db) .paginate(pageRequest1) .wait() }
This patch was released by @gwynne
Full Changelog: 1.52.1...1.52.2