Skip to content

Commit

Permalink
delete broken solvables if the xml parser returns an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Mar 5, 2014
1 parent e67081c commit 147d0dd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ext/repo_appdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,12 @@ repo_add_appdata(Repo *repo, FILE *fp, int flags)
l = fread(buf, 1, sizeof(buf), fp);
if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR)
{
pool_error(pool, -1, "repo_appdata: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser));
pool_error(pool, -1, "repo_appdata: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser));
if (pd.solvable)
{
repo_free_solvable(repo, pd.solvable - pd.pool->solvables, 1);
pd.solvable = 0;
}
ret = -1;
break;
}
Expand Down
6 changes: 5 additions & 1 deletion ext/repo_products.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,12 @@ add_code11_product(struct parsedata *pd, FILE *fp)
if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR)
{
pool_debug(pd->pool, SOLV_ERROR, "%s: %s at line %u:%u\n", pd->filename, XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser));
pool_debug(pd->pool, SOLV_ERROR, "skipping this product\n");
XML_ParserFree(parser);
if (pd->solvable)
{
repo_free_solvable(pd->repo, pd->solvable - pd->pool->solvables, 1);
pd->solvable = 0;
}
return;
}
if (l == 0)
Expand Down
5 changes: 5 additions & 0 deletions ext/repo_zyppdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ add_zyppdb_product(struct parsedata *pd, FILE *fp)
if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR)
{
pool_debug(pd->pool, SOLV_ERROR, "repo_zyppdb: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser));
if (pd->solvable)
{
repo_free_solvable(pd->repo, pd->solvable - pd->pool->solvables, 1);
pd->solvable = 0;
}
return;
}
if (l == 0)
Expand Down

0 comments on commit 147d0dd

Please sign in to comment.