We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e09715a commit 40a388dCopy full SHA for 40a388d
src/ravl/ravl.c
@@ -253,7 +253,10 @@ static int ravl_node_rank(struct ravl_node *n) {
253
*/
254
static int ravl_node_rank_difference_parent(struct ravl_node *p,
255
struct ravl_node *n) {
256
- return ravl_node_rank(p) - ravl_node_rank(n);
+ int rv = ravl_node_rank(p) - ravl_node_rank(n);
257
+ // assert to check integer overflow
258
+ assert(rv < ravl_node_rank(p));
259
+ return rv;
260
}
261
262
/*
@@ -330,6 +333,7 @@ static void ravl_balance(struct ravl *ravl, struct ravl_node *n) {
330
333
ravl_rotate(ravl, z);
331
334
ravl_node_promote(z);
332
335
ravl_node_demote(n);
336
+ assert(y != NULL);
337
ravl_node_demote(y);
338
339
0 commit comments