Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : - fix sidedata segfault
  • From: Michael Schroeder <mls@xxxxxxx>
  • Date: Tue, 30 Jun 2009 12:15:48 +0200
  • Message-id: <E1MLaNe-0004IC-Gm@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 561ca5f6ae0c0df8378bee2f4823855945fb7fec
Author: Michael Schroeder <mls@xxxxxxx>
Date: Tue Jun 30 12:15:48 2009 +0200

- fix sidedata segfault
---
src/repo.h | 34 ++++++++++++----------------------
1 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/src/repo.h b/src/repo.h
index b5329e9..bb6eabd 100644
--- a/src/repo.h
+++ b/src/repo.h
@@ -65,19 +65,14 @@ static inline Id repo_add_solvable(Repo *repo)
extern Id pool_add_solvable(Pool *pool);
Id p = pool_add_solvable(repo->pool);
if (!repo->start || repo->start == repo->end)
- {
- repo->start = p;
- repo->end = p + 1;
- }
- else
- {
- if (p < repo->start)
- repo->start = p;
- if (p + 1 > repo->end)
- repo->end = p + 1;
- }
+ repo->start = repo->end = p;
+ /* warning: sidedata must be extended before adapting start/end */
if (repo->rpmdbid)
repo->rpmdbid = (Id *)repo_sidedata_extend(repo, repo->rpmdbid,
sizeof(Id), p, 1);
+ if (p < repo->start)
+ repo->start = p;
+ if (p + 1 > repo->end)
+ repo->end = p + 1;
repo->nsolvables++;
repo->pool->solvables[p].repo = repo;
return p;
@@ -92,19 +87,14 @@ static inline Id repo_add_solvable_block(Repo *repo, int
count)
return 0;
p = pool_add_solvable_block(repo->pool, count);
if (!repo->start || repo->start == repo->end)
- {
- repo->start = p;
- repo->end = p + count;
- }
- else
- {
- if (p < repo->start)
- repo->start = p;
- if (p + count > repo->end)
- repo->end = p + count;
- }
+ repo->start = repo->end = p;
+ /* warning: sidedata must be extended before adapting start/end */
if (repo->rpmdbid)
repo->rpmdbid = (Id *)repo_sidedata_extend(repo, repo->rpmdbid,
sizeof(Id), p, count);
+ if (p < repo->start)
+ repo->start = p;
+ if (p + count > repo->end)
+ repo->end = p + count;
repo->nsolvables += count;
for (s = repo->pool->solvables + p; count--; s++)
s->repo = repo;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages