SablierV2NFTDescriptor::generateAccentColor generates the saturation and lightness for the stream NFTs. The comments state that both values are bounded to include 100, however in the current code it is not possible for either value to be equal to 100.
SablierV2NFTDescriptor::generateAccentColor()
The two highlighted comments state that the color ranges are bound to [20, 100] and [30,100]. However neither of these colors can be equal to 100.
For saturation to be set to 100:
((bitField >> 8) & 0xFF) % 80 + 20 = 100
((bitField >> 8) & 0xFF) % 80 = 80
However it is not possible for any value when it has %80 applied to be equal to 80, the range is bound to [0,79]. Therefore the real range for saturation is [20,99] and for lightness it's [30,99]. Hue also cannot be equal to 360 and it's real range is [0,359]
The saturation and lightness bounds stated in the code comments are slightly off. It seems the intention was for the value to be able to reach 100 however in the current state this is not possible.
Risk: Low, as it only affects the visuals of the NFT without affecting funds or core functionality.
Manual Review
Change the code comments to revise the ranges to [20, 99], [30,99] and [0,359].
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.