- the problem is about iterating up to including parts.last_index()
using parts.get(parts.last_index()) is a mistake !!!
it works most of the time because most of the time this value is NULL
and the code does a continue
BUT when parts.last_index() == parts.max_size(), then
parts.get(parts.last_index()) is out of the allocated memory and can
contain garbage
- why is the code doing a "continue" ? Is it expected to have a NULL ?
in the list ?
in clean_cloud_volume_read_cb() that fill the list, there is no raison
to have NULL ?
With the bug, testing for NULL will save us 99% of the time
Without the bug we can reach 100% :-)
int rtn=0;
int i;
- for (i=0; (i <= (int)parts.last_index()); i++) {
- if (!parts.get(i)) {
- continue;
- }
+ for (i=0; i < parts.last_index(); i++) {
int r = call_fct("delete", VolumeName, (char*)parts.get(i), NULL, NULL, cancel_cb, err);
if (r == 0) {
Dmsg2(dbglvl, "clean_cloud_volume for %s: Unlink file %s.\n", VolumeName, (char*)parts.get(i));