Description
stillalex, just came across MountPermissionProvider.getNumEntries, which looks as follows:
@Override public long getNumEntries(String principalName, long max) { long num = 0; for (PermissionStoreImpl store : stores) { num += store.getNumEntries(principalName, max); if (num >= max) { break; } } return num; }
If I am not mistaken this may lead to long overflow similar to the one we spotted it in PermissionEntryProviderImpl.init.
Proposed (but untested fix) could look as follows:
@Override public long getNumEntries(String principalName, long max) { long num = 0; for (PermissionStoreImpl store : stores) { num = LongUtils.safeAdd(num, store.getNumEntries(principalName, max)) if (num >= max) { break; } } return num; }
wdyt?
Attachments
Issue Links
- duplicates
-
OAK-7227 MountPermissionProvider getNumEntries prone to overflow
- Closed