forked from len0rd/rockbox
apps: fix tagtree arithmetic on null pointers
It was possible for the tag tree's buflib move callback to turn a null pointer non-null. The tagcache_search_clause->str can be null for OR clauses. Also ensure that clauses are zeroed on allocation to ensure garbage pointers don't creep in. Change-Id: Ic823a8eecc501eeaa75798066521e427a9a89190
This commit is contained in:
parent
6e37b31851
commit
b79eefc858
1 changed files with 3 additions and 2 deletions
|
@ -223,7 +223,8 @@ static int move_callback(int handle, void* current, void* new)
|
||||||
{
|
{
|
||||||
for(int l = 0; l < mentry->si.clause_count[k]; l++)
|
for(int l = 0; l < mentry->si.clause_count[k]; l++)
|
||||||
{
|
{
|
||||||
UPDATE(mentry->si.clause[k][l]->str, diff);
|
if(mentry->si.clause[k][l]->str)
|
||||||
|
UPDATE(mentry->si.clause[k][l]->str, diff);
|
||||||
UPDATE(mentry->si.clause[k][l], diff);
|
UPDATE(mentry->si.clause[k][l], diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -702,7 +703,7 @@ static int get_condition(struct search_instruction *inst)
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_clause = tagtree_alloc(sizeof(struct tagcache_search_clause));
|
new_clause = tagtree_alloc0(sizeof(struct tagcache_search_clause));
|
||||||
if (!new_clause)
|
if (!new_clause)
|
||||||
{
|
{
|
||||||
logf("tagtree failed to allocate %s", "search clause");
|
logf("tagtree failed to allocate %s", "search clause");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue