diff options
author | Michael Schroeder <mls@suse.de> | 2014-04-16 13:57:24 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2014-04-16 13:57:24 +0200 |
commit | 14c1dfbd0d9c3184178e5e1de3aa3f8d2e29f42f (patch) | |
tree | cec22596590ebb75b1b94bce3d55a944faa88d6a | |
parent | cb11f93cb0f785bd19a04a14f9242bc99c4dc187 (diff) | |
download | libsolv-14c1dfbd0d9c3184178e5e1de3aa3f8d2e29f42f.tar.gz libsolv-14c1dfbd0d9c3184178e5e1de3aa3f8d2e29f42f.tar.bz2 libsolv-14c1dfbd0d9c3184178e5e1de3aa3f8d2e29f42f.zip |
repodata_swap_attrs: make sure src and dest are in the repodata
-rw-r--r-- | src/repodata.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/repodata.c b/src/repodata.c index c35da23..d527a42 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -2102,6 +2102,7 @@ repodata_extend_block(Repodata *data, Id start, Id num) return; if (!data->incoreoffset) { + /* this also means that data->attrs is NULL */ data->incoreoffset = solv_calloc_block(num, sizeof(Id), REPODATA_BLOCK); data->start = start; data->end = start + num; @@ -2812,6 +2813,10 @@ repodata_swap_attrs(Repodata *data, Id dest, Id src) Id *tmpattrs; if (!data->attrs || dest == src) return; + if (dest < data->start || dest >= data->end) + repodata_extend(data, dest); + if (src < data->start || src >= data->end) + repodata_extend(data, src); tmpattrs = data->attrs[dest - data->start]; data->attrs[dest - data->start] = data->attrs[src - data->start]; data->attrs[src - data->start] = tmpattrs; |