From: Greg Farnum Date: Wed, 11 Sep 2013 23:24:32 +0000 (-0700) Subject: mds: be more careful about decoding LogEvents X-Git-Tag: v0.71~93 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73289b34b0be5b6612e38944794d59b5e789f841;p=ceph.git mds: be more careful about decoding LogEvents We need to wrap the full decode section or we can abort the process if there's an issue (which we may want to just skip by). Signed-off-by: Greg Farnum Reviewed-by: Sage Weil --- diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc index b775b6d9501c..16e7f8031960 100644 --- a/src/mds/LogEvent.cc +++ b/src/mds/LogEvent.cc @@ -46,10 +46,16 @@ LogEvent *LogEvent::decode(bufferlist& bl) ::decode(type, p); if (EVENT_NEW_ENCODING == type) { - DECODE_START(1, p); - ::decode(type, p); - event = decode_event(bl, p, type); - DECODE_FINISH(p); + try { + DECODE_START(1, p); + ::decode(type, p); + event = decode_event(bl, p, type); + DECODE_FINISH(p); + } + catch (const buffer::error &e) { + generic_dout(0) << "failed to decode LogEvent (type maybe " << type << ")" << dendl; + return NULL; + } } else { // we are using classic encoding event = decode_event(bl, p, type); }