[MERGE][bug #186014] Fix Dirstate Pyrex parser to trap trailing garbage

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Sep 2 13:43:10 BST 2008


>>>>> "jam" == John Arbash Meinel <john.meinel at canonical.com> writes:

    jam> We had a bug in the pyrex dirstate parser if it got to
    jam> the end of the file and there was no trailing '\0'
    jam> character.

    jam> This changes two things. One it makes it so the
    jam> 'get_next()' function properly traps when there is no
    jam> trailing '\0'. Second it preemptively wraps a size check
    jam> around all PyString_FromStringAndSize calls.

    jam> This shouldn't effect performance much, because the C
    jam> checks should be fast, and it only drops into python
    jam> object mode when there is an error.

    jam> It also adds an explicit test that we get an
    jam> AssertionError when we have trailing garbage. I don't
    jam> really *like* AssertionError for this, but it is the
    jam> error we have had so far.

    jam> Best I can come up with is a new "DirstateCorrupted"
    jam> error if we don't want to raise AssertionError.

I'd prefer that.

The other AssertionError are fine though.

Copyright notice update ?

BB:tweak

        Vincent

P.S.: I chose a simple to review patch to check tat BB catch my
votes (caveat emptor).



More information about the bazaar mailing list