The RoundedDownMonthDifference() function in ct_policy_enforcer.cc attempts to return early if end < start, but lacks a "return" statement, so ends up running to completion. The calculation it performs underflows the uint32_t it stores the result in (rounded_months_difference).
Effects of fixing:
- RoundedDownMonthDifference() will produce the apparently intended result when end < start, which is *rounded_months_difference == 0.
- CheckCertPolicyCompliance() will only require 2 SCTs for certificates with negative validity periods. Currently, it requires 2-5 SCTs, depending on how large the negative validity period is. This is fairly moot though, since such certificates will not validate.
See https://cs.chromium.org/chromium/src/net/cert/ct_policy_enforcer.cc?l=61&rcl=5204c87e3a6178b2898f254c2404930a9638b7c5 for the if block that is missing a "return" statement.
Comment 1 by bugdroid1@chromium.org
, Sep 25 2017