Resolve unsafe buffer usage in cpdf_aaction.cpp and cpdf_action.cpp

Conversion to std::array<> solves the issues.

Bug: pdfium:2155
Change-Id: Ib23bd2a901ec5e509b19feb3ec2b250cc2bd706c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/119011
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp
index c50171e..fa86814 100644
--- a/core/fpdfdoc/cpdf_aaction.cpp
+++ b/core/fpdfdoc/cpdf_aaction.cpp
@@ -4,13 +4,9 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#if defined(UNSAFE_BUFFERS_BUILD)
-// TODO(crbug.com/pdfium/2153): resolve buffer safety issues.
-#pragma allow_unsafe_buffers
-#endif
-
 #include "core/fpdfdoc/cpdf_aaction.h"
 
+#include <array>
 #include <iterator>
 #include <utility>
 
@@ -18,34 +14,32 @@
 
 namespace {
 
-constexpr const char* kAATypes[] = {
-    "E",   // kCursorEnter
-    "X",   // kCursorExit
-    "D",   // kButtonDown
-    "U",   // kButtonUp
-    "Fo",  // kGetFocus
-    "Bl",  // kLoseFocus
-    "PO",  // kPageOpen
-    "PC",  // kPageClose
-    "PV",  // kPageVisible
-    "PI",  // kPageInvisible
-    "O",   // kOpenPage
-    "C",   // kClosePage
-    "K",   // kKeyStroke
-    "F",   // kFormat
-    "V",   // kValidate
-    "C",   // kCalculate
-    "WC",  // kCloseDocument
-    "WS",  // kSaveDocument
-    "DS",  // kDocumentSaved
-    "WP",  // kPrintDocument
-    "DP",  // kDocumentPrinted
-};
-
 // |kAATypes| should have one less element than enum AActionType due to
 // |kDocumentOpen|, which is an artificial type.
-static_assert(std::size(kAATypes) == CPDF_AAction::kNumberOfActions - 1,
-              "kAATypes count mismatch");
+constexpr const std::array<const char*, CPDF_AAction::kNumberOfActions - 1>
+    kAATypes = {{
+        "E",   // kCursorEnter
+        "X",   // kCursorExit
+        "D",   // kButtonDown
+        "U",   // kButtonUp
+        "Fo",  // kGetFocus
+        "Bl",  // kLoseFocus
+        "PO",  // kPageOpen
+        "PC",  // kPageClose
+        "PV",  // kPageVisible
+        "PI",  // kPageInvisible
+        "O",   // kOpenPage
+        "C",   // kClosePage
+        "K",   // kKeyStroke
+        "F",   // kFormat
+        "V",   // kValidate
+        "C",   // kCalculate
+        "WC",  // kCloseDocument
+        "WS",  // kSaveDocument
+        "DS",  // kDocumentSaved
+        "WP",  // kPrintDocument
+        "DP",  // kDocumentPrinted
+    }};
 
 }  // namespace
 
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 66b735e..1f5f0d3 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -4,13 +4,9 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#if defined(UNSAFE_BUFFERS_BUILD)
-// TODO(crbug.com/pdfium/2153): resolve buffer safety issues.
-#pragma allow_unsafe_buffers
-#endif
-
 #include "core/fpdfdoc/cpdf_action.h"
 
+#include <array>
 #include <iterator>
 #include <utility>
 
@@ -24,11 +20,26 @@
 
 namespace {
 
-const char* const kActionTypeStrings[] = {
-    "GoTo",       "GoToR",     "GoToE",      "Launch",     "Thread",
-    "URI",        "Sound",     "Movie",      "Hide",       "Named",
-    "SubmitForm", "ResetForm", "ImportData", "JavaScript", "SetOCGState",
-    "Rendition",  "Trans",     "GoTo3DView"};
+const std::array<const char*, 18> kActionTypeStrings = {{
+    "GoTo",
+    "GoToR",
+    "GoToE",
+    "Launch",
+    "Thread",
+    "URI",
+    "Sound",
+    "Movie",
+    "Hide",
+    "Named",
+    "SubmitForm",
+    "ResetForm",
+    "ImportData",
+    "JavaScript",
+    "SetOCGState",
+    "Rendition",
+    "Trans",
+    "GoTo3DView",
+}};
 
 }  // namespace