File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1- // Copyright 2024 Blink Labs Software
1+ // Copyright 2025 Blink Labs Software
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@ package api
1616
1717import (
1818 "encoding/hex"
19+ "math"
1920
2021 "github.com/blinklabs-io/gouroboros/ledger"
2122 "github.com/gin-gonic/gin"
@@ -77,8 +78,13 @@ func handleLocalStateQueryCurrentEra(c *gin.Context) {
7778 return
7879 }
7980
80- // Create response
81+ if eraNum < 0 || eraNum > math .MaxUint8 {
82+ c .JSON (500 , apiError ("era number int overflow" ))
83+ return
84+ }
8185 era := ledger .GetEraById (uint8 (eraNum ))
86+
87+ // Create response
8288 resp := responseLocalStateQueryCurrentEra {
8389 Id : era .Id ,
8490 Name : era .Name ,
@@ -182,6 +188,10 @@ func handleLocalStateQueryTip(c *gin.Context) {
182188 c .JSON (500 , apiError (err .Error ()))
183189 return
184190 }
191+ if eraNum < 0 || eraNum > math .MaxUint8 {
192+ c .JSON (500 , apiError ("era number int overflow" ))
193+ return
194+ }
185195 era := ledger .GetEraById (uint8 (eraNum ))
186196
187197 // Get epochNo
You can’t perform that action at this time.
0 commit comments