gap-packages / guava

GAP package guava - computations relative to error-correcting codes
https://gap-packages.github.io/guava
Other
13 stars 7 forks source link

Fix out of bounds access in the C code #81

Closed fingolfin closed 2 years ago

fingolfin commented 2 years ago

A compiler warning flagged this one: the global array relatorSelection has length 5, but the code tried to access relatorSelection[5] which would be the 6th element, as C uses 0-based indexing.

Upon inspecting the code, it also became clear that relatorSelection[3] never is accessed, and that access to relatorSelection[4] and relatorSelection[5] only occur together, in two places, and both are used to modify selectionPriority.

Based on this, I believe both of those were off-by-one, and adjusted the code accordingly

codecov[bot] commented 2 years ago

Codecov Report

Merging #81 (2711a80) into master (e1eb3d0) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #81   +/-   ##
=======================================
  Coverage   49.37%   49.37%           
=======================================
  Files          44       44           
  Lines       14668    14668           
  Branches      203      203           
=======================================
  Hits         7242     7242           
  Misses       7426     7426