Skip to content

The product of two integers can overflow in L-BFGS #632

@junzi-taotao

Description

@junzi-taotao

What happened?

Hi, i'm trying to use L-BFGS in v2.6.2. But it return failure when the dimension of the problem is 12852225.

How to reproduce the issue?

set *nf to 12852225 for function plis_
static void plis_(int *nf, int *nb, double *x, ...)

Version

v2.6.2

Operating System

Linux

Installation media

unknown

Additional Context

"kit = -(ires1 * *nf + ires2);" this line is in function pils_, line 236, variable kit / ires1 / *nf / ires2 are all int, ires1 is 999, ires2 is 0, *nf is 12852225, then the actual result of -(ires1 * *nf + ires2) is -12,839,372,775, it is less than the lower boundary of int, and this value will cause the following flow incorrect.
Should change the type of kit from int to long (long long)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions