From 14c1dfbd0d9c3184178e5e1de3aa3f8d2e29f42f Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 16 Apr 2014 13:57:24 +0200 Subject: [PATCH] repodata_swap_attrs: make sure src and dest are in the repodata --- src/repodata.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.7.4