|
lintel 0.2.0
|
Functions | |
| const rapidjson::Value * | findMember (const rapidjson::Value &obj, const char *key) |
Hardening helpers for reading JSON from untrusted clients.
rapidjson's HasMember/operator[]/Get* assert on a type mismatch in debug and exhibit undefined behaviour in release: a non-object value reaches MemberBegin() and a wrong-typed member reaches the accessor's reinterpret_cast. Both are reachable from the network, so DTOs read members through these helpers, which report a missing or mistyped member as false instead of crashing. An object that is not an object at all is likewise treated as having no members.