You are reading a single comment by @!evil and its replies. Click here to read the full conversation.
  • Sorry for the confusion, i meant "out of memory", not out of array bounds. I hope the following is better.

    In _jswrap_interface_setTimeoutOrInterval, timerPtr is zero if there isn't enough memory. This might not have immediate consequences if all future ops align well (like jsvObjectSetChildAndUnLock). Or itemIndex may be zero despite a new timer. The consequences in this particular case may be negligible, so it may be just a bad example.

    Regarding jsvObjectSetChildAndUnLock: if jsvObjectSetChildVar returns zero due to "out of memory", it won't unlock child (­b/7277a8dc9377e09f9a6837ff754e3dd8dd7615­63/src/jsvar.c#L3005). Compare with jsvArrayPushAndUnLock where value is unlocked regardless (­b/7277a8dc9377e09f9a6837ff754e3dd8dd7615­63/src/jsvar.c#L3298).

    The main question is: care about "out of memory" (e.g. if (var) { ...; jsvUnLock(var); } all the way) because there is a sane future for the system after the incident, or don't and assume nothing bad will happen. Both viable imo.


Avatar for !evil @!evil started