• Milo Yip's avatar
    Fixed out of bound read in FindMember() and added related new APIs · 02673bec
    Milo Yip authored
    The original FindMember() may access out-of-bound of the 'const char*
    name' parameter.
    This commit firstly follows
    https://github.com/pah/rapidjson/commit/f86af8c232dc280ae510b119018d66ca08b82312
    
    However, this must incur an StrLen() for name. A better API is by using
    Value as the name, which provides the length of string internally. So a
    set of new API are added:
    
    operator[](const GenericValue& name)
    FindMember(const GenericValue& name)
    RemoveMember(const GenericValue& name)
    
    During refactoring, it also adds an API:
    
    RemoveMember(MemberIterator m)
    
    which can be used for other purpose, such as removing a member while
    iterating an object.
    
    Fixes #7
    02673bec
valuetest.cpp 15.5 KB