Conversation
…using yuv-startdb.sh
…into feature/auth0-action
…nts to run as part of test. Also ignore some local files
…olume for db-restore
…into feature/auth0-action
…terising some expected ids that were hard coded into the tests. Also added some docs and seed data for running test
…er as non-root user
…IFF files and also the Z-stack OME tiff file format. CLI commands tiffinfo are helpful to walk through the tiff file structures
…ge (jpeg) tiff, z-stacked tiffs with pyramids etc. Works :)
… with some tests (needs manual data)
…e pyramids or if the tiff already has them
…to feature/bigimage
Implemented tile-based image serving for pyramidal TIFFs to enable
efficient pan/zoom of large scientific images in the frontend.
Changes:
- Add PyramidTileSimple endpoint for local development/testing
- GET /pyramid-tiles/{scan}/{filename}/{page}/{level}/{x}/{y} - serves individual tiles
- GET /pyramid-info/{scan}/{filename} - returns ImagePyramid metadata proto
- Register routes in main.go with public permissions
…to feature/bigimage
…om a given tiff image, and stores it in a local location
…IFF files correctly.
…s requested. This was the only place where existance in the map wasn't being checked. Crashes seemed to end up in the sentry recovery thing but we're now not crashing
| } | ||
|
|
||
| locSave := &protos.ScanEntry{ | ||
| Id: int32(pmc), |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 days ago
In general, you fix this class of issue by either:
- parsing directly into the target bit size using
strconv.ParseInt/ParseUintwith the correctbitSize, or - keeping
Atoibut adding explicit upper and lower bound checks before converting to a narrower integer type.
Here, the safest fix without changing behavior is to parse loc.Id as an int64 with a bit size of 32 and then convert to int32. That guarantees the parsed value is within int32 range or yields an error. Concretely, in core/scan/read-entries.go:
- Replace
pmc, err := strconv.Atoi(loc.Id)withpmc64, err := strconv.ParseInt(loc.Id, 10, 32). - On success, convert with
int32(pmc64)when populatingScanEntry.Id.
The existing error handling already turns any parse error into a returned error, so behavior remains consistent: invalid or out-of-range values will now also produce an error (instead of silent truncation). No new imports are needed because strconv is already imported. The only code changes are renaming the local variable and switching to ParseInt with an appropriate bit size, plus adjusting the type of locSave.Id.
| @@ -26,7 +26,7 @@ | ||
| for _, c := range indexes { | ||
| loc := exprPB.Locations[c] | ||
|
|
||
| pmc, err := strconv.Atoi(loc.Id) | ||
| pmc64, err := strconv.ParseInt(loc.Id, 10, 32) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("Failed to convert PMC %v to int while reading scan location %v", loc.Id, c) | ||
| } | ||
| @@ -40,7 +40,7 @@ | ||
| } | ||
|
|
||
| locSave := &protos.ScanEntry{ | ||
| Id: int32(pmc), | ||
| Id: int32(pmc64), | ||
| Timestamp: timestamp, | ||
| } | ||
|
|
No description provided.