Skip to content

ndratcor_monomial: loops potentially access coefs[i-1] at position 6 which is out of bounds #688

Description

@kostrzewa

when the correction monomial does not converge sufficiently quickly it will access out of bounds array elements

for (int i = 2; i < 8; i++) {
if (delta * delta < mnl->accprec) break;
tm_stopwatch_push(&g_timers, "square_norm", "");
delta = coefs[i - 1] * (square_norm(up0, VOLUME / 2, 1) + square_norm(dn0, VOLUME / 2, 1));
tm_stopwatch_pop(&g_timers, 0, 1, "");
mnl->energy1 += delta;
if (g_debug_level > 2 && g_proc_id == 0)
printf("# NDRATCOR acc step: c_%d*(phi * Z^%d * phi) = %e\n", i, i, delta);
i++; // incrementing i
if (delta * delta < mnl->accprec) break;

and similarly elsewhere

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions