Skip to content

Commit

Permalink
change return type of EngineConfiguration.replayIndexFileCapacityToBy…
Browse files Browse the repository at this point in the history
…tes() to long

It's easy to overflow an int there.
  • Loading branch information
wojciech-adaptive committed Dec 19, 2023
1 parent 67b6d36 commit c10918d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,15 @@ public EngineConfiguration replayIndexSegmentRecordCapacity(final int indexSegme

/**
* Convert the number of records in a replay index file to a file size. Note: because replay index file sizes must
* be a power of two this method can return a file size greater than the requested number of methods but never less.
* be a power of two this method can return a file size greater than the requested number of records but never less.
*
* @param requestedNumberOfRecordsToStore the number of records to store in the replay index.
* @return the replay index file size in bytes
*/
public static int replayIndexFileCapacityToBytes(final int requestedNumberOfRecordsToStore)
public static long replayIndexFileCapacityToBytes(final int requestedNumberOfRecordsToStore)
{
return HEADER_FILE_SIZE + ReplayIndexDescriptor.RECORD_LENGTH *
findNextPositivePowerOfTwo(requestedNumberOfRecordsToStore);
(long)findNextPositivePowerOfTwo(requestedNumberOfRecordsToStore);
}

/**
Expand Down

0 comments on commit c10918d

Please sign in to comment.