Opened 2 years ago

#358 new defect

Null value is not correctly checked in conversion to bool in field.hxx

Reported by: nick.gonzales@… Owned by: jtv
Priority: normal Component: datatypes
Severity: Breaks Keywords:


The following function (starting from line 117 in field.hxx) does not handle bytes == 0 correctly. It seg-faults.

  template<typename T> bool to(T &Obj) const //[t3]
    const char *const bytes = c_str();
    if (!bytes[0] && is_null()) return false;
    from_string(bytes, Obj);
    return true;

Instead, the condition should be:

    if (!bytes || !bytes[0]) return false;

Change History (0)

Note: See TracTickets for help on using tickets.