Protect encoding-vulnerable error reporting code