summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_doc.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-10-10 17:27:33 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-10 17:27:33 +0000
commit7bf816420aa79b23c37ad433183f01dc5af653fa (patch)
tree04aa335d90f659322d1e97ad2fc852e93121dd26 /fpdfsdk/fpdf_doc.cpp
parent73ae71f2f63ab8a3084cb0e691e661b071dc1a92 (diff)
downloadpdfium-7bf816420aa79b23c37ad433183f01dc5af653fa.tar.xz
Better test FPDFAction_* public functions.
Update public documentation. Make implementation match documentation for bad argument types. Change-Id: I70aa3ccaf2580f81d6eb14c6fb4198374010a695 Reviewed-on: https://pdfium-review.googlesource.com/c/43690 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_doc.cpp')
-rw-r--r--fpdfsdk/fpdf_doc.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 614462fa47..28c670c5dd 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -164,11 +164,14 @@ FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION pDict) {
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION pDict) {
- if (!pDict)
- return nullptr;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
+
+ unsigned long type = FPDFAction_GetType(pDict);
+ if (type != PDFACTION_GOTO && type != PDFACTION_REMOTEGOTO)
+ return nullptr;
+
CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
}
@@ -192,11 +195,14 @@ FPDFAction_GetURIPath(FPDF_DOCUMENT document,
FPDF_ACTION pDict,
void* buffer,
unsigned long buflen) {
- if (!pDict)
- return 0;
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
+
+ unsigned long type = FPDFAction_GetType(pDict);
+ if (type != PDFACTION_URI)
+ return 0;
+
CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
ByteString path = action.GetURI(pDoc);
unsigned long len = path.GetLength() + 1;