Skip to content
Snippets Groups Projects
  • Simon Tatham's avatar
    1335e56d
    Fix false negative in Pockle discriminant check. · 1335e56d
    Simon Tatham authored
    I just happened to notice in a re-read of the code that we were
    computing b^2-4a and feeding it to mp_sqrt to check if it was a
    perfect square, without having first checked that the subtraction
    didn't overflow and deliver some arbitrary large positive number when
    the true mathematical value was negative.
    
    Fortunately, if this came up at all, it would have been as a false
    _negative_ in Pockle's primality verification: it might have managed
    to reject a genuine prime with a valid certificate on rare occasions.
    So that's not too serious. But even so, now I've spotted it, fix it.
    1335e56d
    History
    Fix false negative in Pockle discriminant check.
    Simon Tatham authored
    I just happened to notice in a re-read of the code that we were
    computing b^2-4a and feeding it to mp_sqrt to check if it was a
    perfect square, without having first checked that the subtraction
    didn't overflow and deliver some arbitrary large positive number when
    the true mathematical value was negative.
    
    Fortunately, if this came up at all, it would have been as a false
    _negative_ in Pockle's primality verification: it might have managed
    to reject a genuine prime with a valid certificate on rare occasions.
    So that's not too serious. But even so, now I've spotted it, fix it.