Skip to content

Commit

Permalink
Fix error handling in lhash contract
Browse files Browse the repository at this point in the history
When the realloc fails in contract, this not a fatal
error, since the memory is only shrinked. It is also no
option to exit the function at this point, since that
would leave the hash table in an inconsistent state.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #22154)

(cherry picked from commit 5fbfd64)
  • Loading branch information
bernd-edlinger committed Sep 21, 2023
1 parent 44cea98 commit bf01afe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/lhash/lhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ static void contract(OPENSSL_LHASH *lh)
if (n == NULL) {
/* fputs("realloc error in lhash",stderr); */
lh->error++;
return;
} else {
lh->b = n;
}
lh->num_alloc_nodes /= 2;
lh->pmax /= 2;
lh->p = lh->pmax - 1;
lh->b = n;
} else
lh->p--;

Expand Down

0 comments on commit bf01afe

Please sign in to comment.