idtree: import fix from SAMBA source
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 6 Dec 2010 03:00:59 +0000 (13:30 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 6 Dec 2010 03:00:59 +0000 (13:30 +1030)
commit6994f3d0b1fefa78443253b6b9bf4db15f29b3f3
treefc9dcad061ecc5ddc304006c090c0837e2c8b304
parentd208258f51ac8c3b355cd31a874dcf93099b3e98
idtree: import fix from SAMBA source

(Imported from b53f8c187de8)

Author: Rusty Russell <rusty@rustorp.com.au>
Date:   Thu Jun 10 13:27:51 2010 -0700

Since idtree assigns sequentially, it rarely reaches high numbers.
But such numbers can be forced with idr_get_new_above(), and that
reveals two bugs:

1) Crash in sub_remove() caused by pa array being too short.
2) Shift by more than 32 in _idr_find(), which is undefined, causing
   the "outside the current tree" optimization to misfire and return NULL.
ccan/idtree/idtree.c