Skip to content

multprec.cpp: _MP_Rem has apparently nonsense memory read #1008

Description

Consider this line:

if (qh < maxVal && qh * v[n - 2] <= (rh << shift) + u[j + n - 2]) {

This is reported as buggy by PREfast:

warning C6385: Reading invalid data from 'v': the readable size is '16' bytes, but '-8' bytes may be read.

I think PREfast may be correct (because v is an unsigned long long[2]) but don't understand this well enough right now to figure out why this might be OK; if it is OK, we should replace v[n - 2] with v[0] since 2 is the only value of n that doesn't trigger underflow here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething can be improvedfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions