diff options
author | Justus Winter <[email protected]> | 2017-04-06 14:21:48 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-04-06 14:21:48 +0000 |
commit | b83903f59ec5d49ac579f263da70ebc8dc3645b5 (patch) | |
tree | d80020b4954dff8658da6fcf580b93bc29c9cb57 /tests | |
parent | tests: Fix distcheck. (diff) | |
download | gnupg-b83903f59ec5d49ac579f263da70ebc8dc3645b5.tar.gz gnupg-b83903f59ec5d49ac579f263da70ebc8dc3645b5.zip |
gpgscm: Initialize unused slots in vectors.
* tests/gpgscm/scheme.c (get_vector_object): Initialize unused slots
at the end of vectors.
--
They should not be used for anything, but let's just initialize them
to something benign to be sure.
GnuPG-bug-id: 3014
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gpgscm/scheme.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 51fdef04c..3719e5356 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -1083,11 +1083,19 @@ static pointer get_cell(scheme *sc, pointer a, pointer b) static pointer get_vector_object(scheme *sc, int len, pointer init) { pointer cells = get_consecutive_cells(sc, vector_size(len)); + int i; + int alloc_len = 1 + 3 * (vector_size(len) - 1); if(sc->no_memory) { return sc->sink; } /* Record it as a vector so that gc understands it. */ typeflag(cells) = (T_VECTOR | T_ATOM | T_FINALIZE); vector_length(cells) = len; fill_vector(cells,init); + + /* Initialize the unused slots at the end. */ + assert (alloc_len - len < 3); + for (i = len; i < alloc_len; i++) + cells->_object._vector._elements[i] = sc->NIL; + if (gc_enabled (sc)) push_recent_alloc(sc, cells, sc->NIL); return cells; |