From 5ae6c564d16ce8b625df3d1950abc822f9ecc987 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 17 Oct 2018 17:57:51 +0000 Subject: Add CPDF_{Array,Dictionary}Locker to catch illegal iteration patterns. Move begin/end methods onto locker object which tracks whether iterators are in existence. Change-Id: Ia869f313fce48d10a0d0180d0cc083eed6ea1584 Reviewed-on: https://pdfium-review.googlesource.com/c/44070 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fxjs/cjs_document.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fxjs/cjs_document.cpp') diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index adf36be403..2ecfd424d2 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -742,7 +742,8 @@ CJS_Result CJS_Document::get_info(CJS_Runtime* pRuntime) { // PutObjectProperty() calls below may re-enter JS and change info dict. auto pCopy = pDictionary->Clone(); - for (const auto& it : *ToDictionary(pCopy.get())) { + CPDF_DictionaryLocker locker(ToDictionary(pCopy.get())); + for (const auto& it : locker) { const ByteString& bsKey = it.first; CPDF_Object* pValueObj = it.second.get(); WideString wsKey = WideString::FromUTF8(bsKey.AsStringView()); -- cgit v1.2.3