Re: [xml] reporting bug for lixml2.2.6-8



the code. Basically given a pointer to a string the question is whether
that string comes from the dictionnary. To check that the pointer is compared
to the upper and lower bounds of the memory areas used by the dictionnary.
The pointers are unrelated, that's true, str could come from static memory
heap or stack and not being related to the dictionnaries allocated from heap
the comparison is still legal, harmless and the right thing to do in that case.
It's also very cheap, i.e. fast.

Being pedantic, you're not allowed to do "ordering tests" on pointers
unless you are sure they are related.  At least not in ANSI/ISO C.
You'd have to explicit check for == or != against every pointer in
the dictionary.

Perhaps someone will offer a patch that does something like
    #define POINTER_WITHIN(ptr, lo, hi) \
        (ptr >= lo && ptr <= ho)
else
        int pointer_within(void* ptr, void* lo, void* hi)
        {
                char* lop = lo;
                char* hip = hi;
                while (lop <= hip)
                        if (ptr == (void*)lop++) return 1;
                return 0;
        }

you get the idea...
        /r$



--
Rich Salz                  Chief Security Architect
DataPower Technology       http://www.datapower.com
XS40 XML Security Gateway  http://www.datapower.com/products/xs40.html
XML Security Overview      http://www.datapower.com/xmldev/xmlsecurity.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]