check accessing an element past the end of a container

This commit is contained in:
moneromooo-monero 2017-12-12 11:08:11 +00:00
parent 2305bf260d
commit b49ddc766d
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
8 changed files with 46 additions and 12 deletions

View file

@ -259,7 +259,7 @@ namespace cryptonote
ar.tag("rctsig_prunable");
ar.begin_object();
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin.size(), vout.size(),
vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 : 0);
vin.size() > 0 && vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 : 0);
if (!r || !ar.stream().good()) return false;
ar.end_object();
}