]> git.pond.sub.org Git - empserver/commit
Fix crash on edit s, p, u key 'U' with negative argument
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Jan 2013 09:32:54 +0000 (10:32 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 8 May 2013 04:55:21 +0000 (06:55 +0200)
commitbc14b41c6522ecebda67f599435f000354dbe69a
tree5dca68a17f3aaaf064cb1e390801e53f0072cf9c
parent9da83c54c068534599b4008440e30fec1357d824
Fix crash on edit s, p, u key 'U' with negative argument

ef_ensure_space() oopses on negative ID, but succeeds anyway.  edit()
proceeds to ef_write(), which neglects to check for negative ID.
Since the ID isn't in the cache, it then passes a NULL old element to
callback prewrite(), which crashes.

Fix ef_ensure_space() to fail on negative ID.  Commit 5173f8cd
(v4.3.0) made it oops, but neglected to make it fail.

Fix ef_write() to oops and fail on negative ID.

ef_write() still passes NULL old element to prewrite() when the ID
isn't in the cache.  Doesn't actually happen, because we use
prewrite() callbacks only with fully cached tables.  Fragile.  Make
ef_open() fail when that assumption is violated.
src/lib/common/file.c