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.67.4~20 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b3d3b3747c1eef695138dac828e5fcb435309c7b;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 (cherry picked from commit 73289b34b0be5b6612e38944794d59b5e789f841) --- diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc index b775b6d9501c7..16e7f80319609 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); }