On Tue, Apr 11, 2023 at 09:07:49AM +0000, Taylor R Campbell wrote:
> 
> (a) how we can legitimately enter a state where the assertions are
>     violated, and

dklastclose is called when the close operation ends in no more openers.
There is nothing that guarantees that any open was successful before
with the effect that dk_rawopens is > 0 and dk_rawvp is not NULL.

In that state then decrementing dk_rawopens beyond zero will make
dklastclose do the right thing: nothing.

When you want to check for overflows of dk_rawopens (which is difficult
to overflow as you had to create 2^32 wedges) you need to watch it being
incremented (also temporarily). Crashing after the fact with an assertion
in dklastclose doesn't help.

-- 
                                Michael van Elst
Internet: mlel...@serpens.de
                                "A potential Snark may lurk in every tree."

Reply via email to