Repository navigation
Commit 23174b9
Fix PropTSVecTable out-of-bounds from non-uniform geometry traces (#27)
Root cause is on the parser side. gaussian-*.desc routes THREE parse
types into one property: [GEOMTRACE] from "Input orientation:", another
[GEOMTRACE] from "Z-Matrix orientation:", and [GEOMTRACE1] from
"Standard orientation:". All three run gaussian-*.geomtrace, which
hardcodes 'key: GEOMTRACE' regardless of which parse type invoked it,
and the stored key comes from that line, not the parse type -- so all
three land in GEOMTRACE. (There is no GEOMTRACE1 property at all.)
Those blocks do not have the same atom count. Gaussian prints Z-matrix
dummy centres (atomic number -1) in "Z-Matrix orientation" but omits
them from "Standard orientation". Verified on a real g16 NH3 Z-matrix
optimization with one dummy centre: the same job alternates 5-row and
4-row steps into one PropTSVecTable.
PropTSVecTable then takes its declared shape from the FIRST step only
(DavPropCache::putTSProp writes rows/columns just once, on document
creation; later steps append bare <step> children), and value() checked
row/col against that declared shape without ever reconciling it against
the actual vector length. With p_numRows=5/p_numColumns=3 from a
5-row first step, value(1,4,2) computes index 4*3+2=14 into a 12-element
vector -- reading 2 elements past the end. Reproduced as a real
AddressSanitizer heap-buffer-overflow.
A prior commit (f8e3be6) attributed #27 to PropTSVecVector::value()'s
inverted bounds check. That was a different, real bug; the accessor
named in this issue's title was not in its list, so #27 was still live.
Fixed on both sides:
Parser (the root cause) -- skip dummy centres (atomic number < 0) and
renumber row labels sequentially, in all 8 gaussian-*.geomtrace{,-input}
scripts. Ghost/Bq centres (atomic number 0) are deliberately kept, since
they appear consistently in every orientation block.
This also fixes an independent silent-corruption bug: a dummy can sit
anywhere in the centre list, so every atom after it was given the
WRONG atom's coordinates. On the NH3 fixture the old output was
"1-N 2-Uns 3-H 4-H 5-H" -- a phantom atom (the "Uns" label is
$atomicSymbol[-1], Perl's negative index landing on the last element of
the periodic table) with the real hydrogens shifted down a row. Any
Z-matrix job with dummy atoms had a silently wrong geometry trace,
independent of the crash.
Storage (the backstop) -- across PropTSVecTable, PropVecTable,
PropTSTable and PropTSVecVector: value() now bounds-checks the computed
index against the actual vector size, not just the declared shape;
values(int) bounds-checks its table index (it was unchecked); setValues()
drops steps whose size disagrees with rows*columns and no longer leaks
the previous p_values; and appendTable() refuses malformed tables
instead of warning and pushing them anyway. EE_FATAL (exit(1)) in these
paths is downgraded to a warning plus refusal -- malformed parser output
killed the entire GUI rather than dropping one step, and
PropertyTask::updatePropTSVecTable already drops mismatched steps
silently, so refusing is the consistent behaviour.
Both sides were needed: hardening the accessor alone would leave the
trace silently wrong (dummy coordinates on real atoms), and fixing the
parser alone would leave every other code able to produce the same
over-read through an unvalidated setValues().
src/tdat/test/PropTSVecTableIssue27Test.C is a standalone reproduction
(not wired into CMake, matching the src/dsm/dav/test convention); build
instructions are in its header. Pre-fix it trips ASan, post-fix it is
clean.
Verified: ninja builder and a full ninja are clean. Old vs new parser on
the real fixture gives 5-row/4-row steps before and uniform 4-row steps
after.
NOT verified: no live GUI this session, so the end-to-end path (dummy-
atom job through ECCE, geometry trace in Builder) is untested. The
original reporter's G09 file is unavailable, so their specific trigger
is unconfirmed -- see the follow-up issue on VIB being cast to
PropTSVecTable*, which reports the same assertion location.
Per this bug family's usual caveat, already-parsed jobs are not
retroactively fixed; their stored steps are now dropped with a warning
rather than over-read.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 4cb500b commit 23174b9
13 files changed
Lines changed: 375 additions & 33 deletions
File tree
- scripts/parsers
- src/tdat
- properties
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
120 | 130 | | |
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
127 | 143 | | |
128 | 144 | | |
129 | 145 | | |
| |||
261 | 277 | | |
262 | 278 | | |
263 | 279 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
267 | 288 | | |
268 | 289 | | |
269 | 290 | | |
270 | | - | |
271 | | - | |
| 291 | + | |
| 292 | + | |
272 | 293 | | |
273 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
274 | 297 | | |
275 | 298 | | |
276 | 299 | | |
| |||
0 commit comments