Repository navigation
lib/raster: Fix crash when writing rasters with 268,435,455 or more rows - #8320
Valyrian-Code wants to merge 2 commits into
Conversation
|
Can you check the performance of it? I would hope the loops are somehow rolled out, but without numbers, it does not look good adding loops to this place. Also, it is more code then I hoped, but that's not a surprise. |
I timed main vs this PR and see no difference beyond noise, on macOS and Linux. The loop runs once per call unless the table is over INT_MAX bytes. Would you like me to keep it this way, or should I make it smaller and just stop with an error for tables that large? |
Fixes #8317.
G_zero()takes an int size and crashed on the row pointer tables from 268,435,455 rows.G_calloc()already zeroes them, so those calls are removed.The table sizes in format.c are now size_t, and the table is read and written in pieces of at most INT_MAX bytes, the macOS limit per call.
Tested on macOS: maps of 268,435,455 and 536,870,912 rows write and read back correctly, and small maps are byte-identical to main. No CI test, since it needs a 2 GB row table.