Skip to content

Commit

Permalink
<bugfix>: uint out of range bug, when xaTransactionIDs is empty and _…
Browse files Browse the repository at this point in the history
…index is -1, len - 1 will out of range
  • Loading branch information
dwzhan committed Oct 26, 2023
1 parent fdd9611 commit 92bb97f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/resources/bcos3_sol/WeCrossProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,13 @@ contract WeCrossProxy {
function listXATransactions(string memory _index, uint256 _size) public view
returns (string memory) {
uint256 len = xaTransactionIDs.length;
uint256 index = sameString("-1", _index)
? (len - 1)
: stringToUint256(_index);
if (len == 0) {
return '{"total":0,"xaTransactions":[]}';
}

uint256 index = sameString("-1", _index) ? (len - 1) : stringToUint256(_index);

if (len == 0 || len <= index) {
if (len <= index) {
return '{"total":0,"xaTransactions":[]}';
}

Expand Down

0 comments on commit 92bb97f

Please sign in to comment.