From ac9c1f0d560540fda821b2775a475c71b47cb3a0 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 5 Oct 2013 19:42:39 -0400 Subject: Security: replace operator[] with at For std::string and std::vector, replace operator[] with at. This was done using an automated process. See README.hardening for details. --- libqpdf/QPDFObjectHandle.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libqpdf/QPDFObjectHandle.cc') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 442678fd..ef92e3ac 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -712,7 +712,7 @@ QPDFObjectHandle::parse(std::string const& object_str, size_t offset = input->tell(); while (offset < object_str.length()) { - if (! isspace(object_str[offset])) + if (! isspace(object_str.at(offset))) { QTC::TC("qpdf", "QPDFObjectHandle trailing data in parse"); throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), @@ -966,8 +966,8 @@ QPDFObjectHandle::parseInternal(PointerHolder input, std::string const& value = token.getValue(); if ((value == "R") && (in_array || in_dictionary) && (olist.size() >= 2) && - (olist[olist.size() - 1].isInteger()) && - (olist[olist.size() - 2].isInteger())) + (olist.at(olist.size() - 1).isInteger()) && + (olist.at(olist.size() - 2).isInteger())) { if (context == 0) { @@ -979,8 +979,8 @@ QPDFObjectHandle::parseInternal(PointerHolder input, // Try to resolve indirect objects object = newIndirect( context, - olist[olist.size() - 2].getIntValue(), - olist[olist.size() - 1].getIntValue()); + olist.at(olist.size() - 2).getIntValue(), + olist.at(olist.size() - 1).getIntValue()); olist.pop_back(); olist.pop_back(); } @@ -1067,8 +1067,8 @@ QPDFObjectHandle::parseInternal(PointerHolder input, } for (unsigned int i = 0; i < olist.size(); i += 2) { - QPDFObjectHandle key_obj = olist[i]; - QPDFObjectHandle val = olist[i + 1]; + QPDFObjectHandle key_obj = olist.at(i); + QPDFObjectHandle val = olist.at(i + 1); if (! key_obj.isName()) { throw QPDFExc( -- cgit v1.2.3-54-g00ecf