It looks like the improved /24 prefix counting code introduced a subtle stack corruption somewhere in bvc_pergeovisibility.c. The code runs fine on Thor, where we did all of the testing, but it fails on bgpview-consumers-ioda. We believe that the variable num_ips somehow gets corrupted, which leads to cur_address not being updated:
We first fixed the issue by ensuring that cur_address either points to the end or the beginning of the given prefix. Apparently we only fixed the symptom but not the issue's root cause.
The bug happens regardless of optimisation, i.e., -O0-compiled code triggers it and so does -O3. Adding printf or assert statements also makes the bug disappear, so it may have something to do with the memory layout. Commit e8fa1da seems to be working so far but 5074710 (and possibly past commits) is broken.
It looks like the improved /24 prefix counting code introduced a subtle stack corruption somewhere in
bvc_pergeovisibility.c. The code runs fine on Thor, where we did all of the testing, but it fails on bgpview-consumers-ioda. We believe that the variablenum_ipssomehow gets corrupted, which leads tocur_addressnot being updated:bgpview/lib/consumers/bvc_pergeovisibility.c
Line 1117 in dc728b8
We first fixed the issue by ensuring that
cur_addresseither points to the end or the beginning of the given prefix. Apparently we only fixed the symptom but not the issue's root cause.The bug happens regardless of optimisation, i.e.,
-O0-compiled code triggers it and so does-O3. Addingprintforassertstatements also makes the bug disappear, so it may have something to do with the memory layout. Commit e8fa1da seems to be working so far but 5074710 (and possibly past commits) is broken.