bitcoin/bitcoin — pull request #4955 by ENikS (2014-09-22 01:28:48+00:00)
Title: Fixing improper input syntax and failing bounds check

This code does not make much sense from modern compiler point of view.

I need to investigate further but it looks like under certain circumstances it might allow reading beyond **vch.end()** and could be similar to heart-bleed bug of OpenSSL http://en.wikipedia.org/wiki/Heartbleed

It might take me a bit to understand all of the cases this method is involved with, meanwhile here is the fix.