Skip to content

Commit

Permalink
[PPANTT-91] fix: paging issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-cialini committed Aug 21, 2024
1 parent 089087e commit 1e9d386
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ExternalServiceImpl(BrokerInstitutionsRepository brokerInstitutionsReposi
@Override
public BrokerInstitutionsResponse getBrokerInstitutions(String brokerCode, Integer limit, Integer page) {
Optional<BrokerInstitutionAggregate> brokerInstitutionsEntity = brokerInstitutionsRepository
.findPagedInstitutionsByBrokerCode(brokerCode, page == 0 ? 0 : ((page * limit) - 1), limit);
.findPagedInstitutionsByBrokerCode(brokerCode, page * limit, limit);

Check failure

Code scanning / CodeQL

User-controlled data in arithmetic expression High

This arithmetic expression depends on a
user-provided value
, potentially causing an underflow.
This arithmetic expression depends on a
user-provided value
, potentially causing an underflow.
This arithmetic expression depends on a
user-provided value
, potentially causing an overflow.
This arithmetic expression depends on a
user-provided value
, potentially causing an overflow.
if (brokerInstitutionsEntity.isEmpty() ||
brokerInstitutionsEntity.get().getInstitutionEntities() == null) {
throw new AppException(AppError.BROKER_INSTITUTIONS_NOT_FOUND, brokerCode);
Expand Down Expand Up @@ -89,7 +89,7 @@ public CIIbansResponse getCIsIbans(Integer limit, Integer page) {
public CIIbansResponse getBrokerIbans(String brokerCode, Integer limit, Integer page) {
Pageable pageable = PageRequest.of(page, limit);
Optional<IbanAggregate> brokerIbanAggregate = brokerIbansRepository.getBrokerIbans(
brokerCode, page == 0 ? 0 : ((page * limit) - 1), limit);
brokerCode, page * limit, limit);

Check failure

Code scanning / CodeQL

User-controlled data in arithmetic expression High

This arithmetic expression depends on a
user-provided value
, potentially causing an underflow.
This arithmetic expression depends on a
user-provided value
, potentially causing an underflow.
This arithmetic expression depends on a
user-provided value
, potentially causing an overflow.
This arithmetic expression depends on a
user-provided value
, potentially causing an overflow.
if (brokerIbanAggregate.isEmpty() ||
brokerIbanAggregate.get().getIbansSlice() == null) {
throw new AppException(AppError.BROKER_IBANS_NOT_FOUND, brokerCode);
Expand Down

0 comments on commit 1e9d386

Please sign in to comment.