Mark unsafe regions in cfgas_gegraphics.cpp.

Also convert some usage to std::array<>.

Change-Id: Ic6dff542ad1c59d4eea075523c0fdbdd9f25ab01
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/119577
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index e5aabb3..f200d93 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -4,22 +4,20 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#if defined(UNSAFE_BUFFERS_BUILD)
-// TODO(crbug.com/pdfium/2154): resolve buffer safety issues.
-#pragma allow_unsafe_buffers
-#endif
-
 #include "xfa/fgas/graphics/cfgas_gegraphics.h"
 
 #include <math.h>
 
+#include <array>
 #include <iterator>
 #include <memory>
 #include <utility>
 
 #include "core/fxcrt/check.h"
+#include "core/fxcrt/compiler_specific.h"
 #include "core/fxcrt/fx_system.h"
 #include "core/fxcrt/span_util.h"
+#include "core/fxcrt/stl_util.h"
 #include "core/fxge/cfx_defaultrenderdevice.h"
 #include "core/fxge/cfx_renderdevice.h"
 #include "core/fxge/cfx_unicodeencoding.h"
@@ -37,7 +35,7 @@
   uint8_t maskBits[64];
 };
 
-const FX_HATCHDATA kHatchBitmapData[] = {
+constexpr auto kHatchBitmapData = fxcrt::ToArray<const FX_HATCHDATA>({
     {16,  // Horizontal
      16,
      {
@@ -98,7 +96,7 @@
          0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x24, 0x24, 0x00,
          0x00, 0x42, 0x42, 0x00, 0x00, 0x81, 0x81, 0x00, 0x00,
      }},
-};
+});
 
 const FX_HATCHDATA kHatchPlaceHolder = {
     0,
@@ -323,7 +321,8 @@
               scale = 1.0f;
             }
           }
-          dib_buf[column] = m_info.fillColor.GetShading()->GetArgb(scale);
+          UNSAFE_TODO(dib_buf[column]) =
+              m_info.fillColor.GetShading()->GetArgb(scale);
         }
       }
       result = true;
@@ -384,7 +383,8 @@
               continue;
             s = 1.0f;
           }
-          dib_buf[column] = m_info.fillColor.GetShading()->GetArgb(s);
+          UNSAFE_TODO(dib_buf[column]) =
+              m_info.fillColor.GetShading()->GetArgb(s);
         }
       }
       result = true;