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. --- examples/pdf-bookmarks.cc | 2 +- examples/pdf-mod-info.cc | 2 +- examples/pdf-parse-content.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/pdf-bookmarks.cc b/examples/pdf-bookmarks.cc index 5d11fb32..23b7f0cf 100644 --- a/examples/pdf-bookmarks.cc +++ b/examples/pdf-bookmarks.cc @@ -31,7 +31,7 @@ void print_lines(std::vector& numbers) { for (unsigned int i = 0; i < numbers.size() - 1; ++i) { - if (numbers[i]) + if (numbers.at(i)) { std::cout << "| "; } diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc index 8bd9f5d6..84cb818f 100644 --- a/examples/pdf-mod-info.cc +++ b/examples/pdf-mod-info.cc @@ -128,7 +128,7 @@ int main(int argc, char* argv[]) { QTC::TC("examples", "pdf-mod-info -key"); cur_key = argv[i]; - if (! ((cur_key.length() > 0) && (cur_key[0] == '/'))) + if (! ((cur_key.length() > 0) && (cur_key.at(0) == '/'))) { cur_key = "/" + cur_key; } diff --git a/examples/pdf-parse-content.cc b/examples/pdf-parse-content.cc index 0394e938..7f11be05 100644 --- a/examples/pdf-parse-content.cc +++ b/examples/pdf-parse-content.cc @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) usage(); } - QPDFObjectHandle page = pages[pageno-1]; + QPDFObjectHandle page = pages.at(pageno-1); QPDFObjectHandle contents = page.getKey("/Contents"); ParserCallbacks cb; QPDFObjectHandle::parseContentStream(contents, &cb); -- cgit v1.2.3-70-g09d2