I'll attach the new testcase once I either get it to reproduce this bug or give up and leave the basic xlogdump testcase alone.
I had another bash at this and I still can't reproduce it on master using the giant commit record approach Andres suggested. In fact I generated a commit record larger than an entire xlog segment and it was still fine.
The DO procedure I posted upthread, when run on 9.4, reliably produces segments that the xlogreader cannot decode with the symptoms Pavan reported. It's fine on 9.6.
So I can't reproduce this on 9.6, but there might be a separate bug on 9.4.
I've attached a patch with the simple tests I added for pg_xlogdump as part of this. I doubt it'd be desirable to commit the ridiculous commit record part, but that's trivially removed, and I left it in place in case someone else wanted to fiddle with other ways to reproduce this.