diff --git a/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc b/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc
index 7586209232568..5d41a2c5db8bc 100644
--- a/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc
+++ b/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc
@@ -178,7 +178,7 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
   slice_param.slice_data_flag = VA_SLICE_DATA_FLAG_ALL;
 
   static_assert(
-      std::extent<decltype(Vp9SegmentationParams::feature_enabled)>() ==
+      std::tuple_size<decltype(Vp9SegmentationParams::feature_enabled)>() ==
           std::extent<decltype(slice_param.seg_param)>(),
       "seg_param array of incorrect size");
   for (size_t i = 0; i < std::size(slice_param.seg_param); ++i) {
@@ -193,7 +193,10 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
                  seg.FeatureEnabled(i, Vp9SegmentationParams::SEG_LVL_SKIP));
 #undef SEG_TO_SP_SF
 
-    SafeArrayMemcpy(seg_param.filter_level, lf.lvl[i]);
+    for (size_t j = 0; j < std::size(seg_param.filter_level); ++j) {
+      base::span(seg_param.filter_level[j])
+          .copy_from(base::span(lf.lvl[i][j]));
+    }
 
     seg_param.luma_dc_quant_scale = seg.y_dequant[i][0];
     seg_param.luma_ac_quant_scale = seg.y_dequant[i][1];
diff --git a/media/parsers/vp9_parser.cc b/media/parsers/vp9_parser.cc
index 9ff83c7184829..4ef5207c7f427 100644
--- a/media/parsers/vp9_parser.cc
+++ b/media/parsers/vp9_parser.cc
@@ -9,10 +9,9 @@
 //  2 parsing steps
 //  3 parsed values (selected)
 
-#ifdef UNSAFE_BUFFERS_BUILD
-// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
-#pragma allow_unsafe_buffers
-#endif
+#include "base/containers/auto_spanification_helper.h"
+
+
 
 #include "media/parsers/vp9_parser.h"
 
@@ -359,14 +358,20 @@ bool Vp9FrameContext::IsValid() const {
   // probs should be in [1, 255] range.
   static_assert(sizeof(Vp9Prob) == 1,
                 "following checks assuming Vp9Prob is single byte");
-  if (memchr(tx_probs_8x8, 0, sizeof(tx_probs_8x8))) {
-    return false;
+  for (const auto& row : tx_probs_8x8) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(tx_probs_16x16, 0, sizeof(tx_probs_16x16))) {
-    return false;
+  for (const auto& row : tx_probs_16x16) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(tx_probs_32x32, 0, sizeof(tx_probs_32x32))) {
-    return false;
+  for (const auto& row : tx_probs_32x32) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
 
   for (auto& a : coef_probs) {
@@ -385,61 +390,87 @@ bool Vp9FrameContext::IsValid() const {
       }
     }
   }
-  if (memchr(skip_prob, 0, sizeof(skip_prob))) {
+  if (std::ranges::find(skip_prob, 0) != std::ranges::end(skip_prob)) {
     return false;
   }
-  if (memchr(inter_mode_probs, 0, sizeof(inter_mode_probs))) {
-    return false;
+  for (const auto& row : inter_mode_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(interp_filter_probs, 0, sizeof(interp_filter_probs))) {
-    return false;
+  for (const auto& row : interp_filter_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(is_inter_prob, 0, sizeof(is_inter_prob))) {
+  if (std::ranges::find(is_inter_prob, 0) != std::ranges::end(is_inter_prob)) {
     return false;
   }
-  if (memchr(comp_mode_prob, 0, sizeof(comp_mode_prob))) {
+  if (std::ranges::find(comp_mode_prob, 0) !=
+      std::ranges::end(comp_mode_prob)) {
     return false;
   }
-  if (memchr(single_ref_prob, 0, sizeof(single_ref_prob))) {
-    return false;
+  for (const auto& row : single_ref_prob) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(comp_ref_prob, 0, sizeof(comp_ref_prob))) {
+  if (std::ranges::find(comp_ref_prob, 0) != std::ranges::end(comp_ref_prob)) {
     return false;
   }
-  if (memchr(y_mode_probs, 0, sizeof(y_mode_probs))) {
-    return false;
+  for (const auto& row : y_mode_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(uv_mode_probs, 0, sizeof(uv_mode_probs))) {
-    return false;
+  for (const auto& row : uv_mode_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(partition_probs, 0, sizeof(partition_probs))) {
-    return false;
+  for (const auto& row : partition_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(mv_joint_probs, 0, sizeof(mv_joint_probs))) {
+  if (std::ranges::find(mv_joint_probs, 0) !=
+      std::ranges::end(mv_joint_probs)) {
     return false;
   }
-  if (memchr(mv_sign_prob, 0, sizeof(mv_sign_prob))) {
+  if (std::ranges::find(mv_sign_prob, 0) != std::ranges::end(mv_sign_prob)) {
     return false;
   }
-  if (memchr(mv_class_probs, 0, sizeof(mv_class_probs))) {
-    return false;
+  for (const auto& row : mv_class_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(mv_class0_bit_prob, 0, sizeof(mv_class0_bit_prob))) {
+  if (std::ranges::find(mv_class0_bit_prob, 0) !=
+      std::ranges::end(mv_class0_bit_prob)) {
     return false;
   }
-  if (memchr(mv_bits_prob, 0, sizeof(mv_bits_prob))) {
-    return false;
+  for (const auto& row : mv_bits_prob) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(mv_class0_fr_probs, 0, sizeof(mv_class0_fr_probs))) {
-    return false;
+  for (const auto& row : mv_class0_fr_probs) {
+    for (const auto& inner_row : row) {
+      if (std::ranges::find(inner_row, 0) != std::ranges::end(inner_row)) {
+        return false;
+      }
+    }
   }
-  if (memchr(mv_fr_probs, 0, sizeof(mv_fr_probs))) {
-    return false;
+  for (const auto& row : mv_fr_probs) {
+    if (std::ranges::find(row, 0) != std::ranges::end(row)) {
+      return false;
+    }
   }
-  if (memchr(mv_class0_hp_prob, 0, sizeof(mv_class0_hp_prob))) {
+  if (std::ranges::find(mv_class0_hp_prob, 0) !=
+      std::ranges::end(mv_class0_hp_prob)) {
     return false;
   }
-  if (memchr(mv_hp_prob, 0, sizeof(mv_hp_prob))) {
+  if (std::ranges::find(mv_hp_prob, 0) != std::ranges::end(mv_hp_prob)) {
     return false;
   }
 
@@ -447,9 +478,9 @@ bool Vp9FrameContext::IsValid() const {
 }
 
 void Vp9Parser::Context::Reset() {
-  memset(&segmentation_, 0, sizeof(segmentation_));
-  memset(&loop_filter_, 0, sizeof(loop_filter_));
-  memset(&ref_slots_, 0, sizeof(ref_slots_));
+  segmentation_ = {};
+  loop_filter_ = {};
+  ref_slots_ = {};
 }
 
 const Vp9Parser::ReferenceSlot& Vp9Parser::Context::GetRefSlot(
@@ -502,7 +533,7 @@ bool Vp9Parser::ParseUncompressedHeader(const FrameInfo& frame_info,
                                         Vp9FrameHeader* fhdr,
                                         Result* result,
                                         Vp9Parser::Context* context) {
-  memset(&curr_frame_header_, 0, sizeof(curr_frame_header_));
+  curr_frame_header_ = {};
   *result = kInvalidStream;
 
   Vp9UncompressedHeaderParser uncompressed_parser(context);
@@ -646,7 +677,7 @@ bool Vp9Parser::IsSuperframe(const uint8_t* stream,
 
   // If this is a superframe, the last byte in the stream will contain the
   // superframe marker. If not, the whole buffer contains a single frame.
-  uint8_t marker = *(stream + marker_offset);
+  uint8_t marker = UNSAFE_BUFFERS(base::span(stream, base::checked_cast<size_t>(stream_size)))[marker_offset];
   return ((marker & 0xe0) == 0xc0);
 }
 
@@ -656,9 +687,10 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ExtractFrames(
     off_t stream_size,
     const DecryptConfig* decrypt_config) {
   base::circular_deque<FrameInfo> frames;
+  auto stream_span = UNSAFE_BUFFERS(base::span(stream, base::checked_cast<size_t>(stream_size)));
   off_t bytes_left = stream_size;
 
-  if (!stream || bytes_left < 1) {
+  if (stream_span.empty()) {
     return frames;
   }
 
@@ -671,7 +703,7 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ExtractFrames(
   }
 
   off_t marker_offset = stream_size - 1;
-  uint8_t marker = *(stream + marker_offset);
+  uint8_t marker = stream_span[marker_offset];
 
   DVLOG(1) << "Parsing a superframe";
 
@@ -686,12 +718,13 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ExtractFrames(
     return base::circular_deque<FrameInfo>();
   }
 
-  const uint8_t* index_ptr = stream + bytes_left - index_size;
-  if (marker != *index_ptr) {
+  auto index_span = stream_span.subspan(
+      base::checked_cast<size_t>(bytes_left - index_size));
+  if (marker != index_span[0]) {
     return base::circular_deque<FrameInfo>();
   }
 
-  ++index_ptr;
+  index_span = index_span.subspan(1);
   bytes_left -= index_size;
 
   // Parse frame information contained in the index and add a pointer to and
@@ -710,8 +743,8 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ExtractFrames(
   for (size_t i = 0; i < num_frames; ++i) {
     uint32_t size = 0;
     for (size_t j = 0; j < mag; ++j) {
-      size |= *index_ptr << (j * 8);
-      ++index_ptr;
+      size |= index_span[0] << (j * 8);
+      index_span = index_span.last(index_span.size() - 1);
     }
 
     if (!base::IsValueInRangeForNumericType<off_t>(size) ||
@@ -736,6 +769,7 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ExtractFrames(
     }
 
     frames.push_back(std::move(frame));
+    stream_span = stream_span.subspan(size);
     stream += size;
     bytes_left -= size;
 
@@ -763,8 +797,8 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ParseSVCFrame() {
     return {};
   }
 
-  const uint8_t* stream = stream_;
-  off_t bytes_left = bytes_left_;
+  auto stream_span = UNSAFE_BUFFERS(
+      base::span(stream_.get(), base::checked_cast<size_t>(bytes_left_)));
 
   // Make sure we don't parse stream_ more than once.
   stream_ = nullptr;
@@ -775,14 +809,13 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ParseSVCFrame() {
   for (size_t i = 0; i < spatial_layer_frame_size_.size(); i++) {
     const uint32_t size = spatial_layer_frame_size_[i];
     if (!base::IsValueInRangeForNumericType<off_t>(size) ||
-        static_cast<off_t>(size) > bytes_left) {
+        size > stream_span.size()) {
       DVLOG(1) << "Not enough data in the buffer for frame " << i;
       return {};
     }
 
-    frames.emplace_back(stream, size);
-    stream += size;
-    bytes_left -= size;
+    frames.emplace_back(stream_span.data(), size);
+    stream_span = stream_span.subspan(size);
     DVLOG(1) << "Frame " << i << ", size: " << size;
   }
 
@@ -797,8 +830,7 @@ base::circular_deque<Vp9Parser::FrameInfo> Vp9Parser::ParseSVCFrame() {
   Context tmp_context;
   tmp_context.segmentation_ = context_.segmentation_;
   tmp_context.loop_filter_ = context_.loop_filter_;
-  memcpy(tmp_context.ref_slots_, context_.ref_slots_,
-         sizeof(context_.ref_slots_));
+  base::span(tmp_context.ref_slots_).copy_from(context_.ref_slots_);
   for (const auto& frame_info : frames) {
     // |curr_frame_header_| is used safely because it is reset every
     // ParseUncompressedHeader().
@@ -895,7 +927,9 @@ void Vp9Parser::SetupLoopFilter() {
     }
 
     if (!loop_filter.delta_enabled) {
-      memset(loop_filter.lvl[i], level, sizeof(loop_filter.lvl[i]));
+      for (auto& row : loop_filter.lvl[i]) {
+        std::ranges::fill(row, level);
+      }
     } else {
       loop_filter.lvl[i][Vp9RefType::VP9_FRAME_INTRA][0] = ClampLf(
           level + loop_filter.ref_deltas[Vp9RefType::VP9_FRAME_INTRA] * scale);
diff --git a/media/parsers/vp9_parser.h b/media/parsers/vp9_parser.h
index 60bb0e9cb222f..cfbb0f21189e8 100644
--- a/media/parsers/vp9_parser.h
+++ b/media/parsers/vp9_parser.h
@@ -10,10 +10,9 @@
 // See media::VP9Decoder for example usage.
 //
 
-#ifdef UNSAFE_BUFFERS_BUILD
-// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
-#pragma allow_unsafe_buffers
-#endif
+#include <array>
+
+
 #ifndef MEDIA_PARSERS_VP9_PARSER_H_
 #define MEDIA_PARSERS_VP9_PARSER_H_
 
@@ -97,11 +96,11 @@ struct MEDIA_EXPORT Vp9SegmentationParams {
 
   bool update_data;
   bool abs_or_delta_update;
-  bool feature_enabled[kNumSegments][SEG_LVL_MAX];
-  int16_t feature_data[kNumSegments][SEG_LVL_MAX];
+  std::array<std::array<bool, SEG_LVL_MAX>, kNumSegments> feature_enabled;
+  std::array<std::array<int16_t, SEG_LVL_MAX>, kNumSegments> feature_data;
 
-  int16_t y_dequant[kNumSegments][2];
-  int16_t uv_dequant[kNumSegments][2];
+  std::array<std::array<int16_t, 2>, kNumSegments> y_dequant;
+  std::array<std::array<int16_t, 2>, kNumSegments> uv_dequant;
 
   bool FeatureEnabled(size_t seg_id, SegmentLevelFeature feature) const {
     return feature_enabled[seg_id][feature];
@@ -120,14 +119,13 @@ struct MEDIA_EXPORT Vp9LoopFilterParams {
 
   bool delta_enabled;
   bool delta_update;
-  bool update_ref_deltas[VP9_FRAME_MAX];
-  int8_t ref_deltas[VP9_FRAME_MAX];
-  bool update_mode_deltas[kNumModeDeltas];
-  int8_t mode_deltas[kNumModeDeltas];
+  std::array<bool, VP9_FRAME_MAX> update_ref_deltas;
+  std::array<int8_t, VP9_FRAME_MAX> ref_deltas;
+  std::array<bool, kNumModeDeltas> update_mode_deltas;
+  std::array<int8_t, kNumModeDeltas> mode_deltas;
 
   // Calculated from above fields.
-  uint8_t lvl[Vp9SegmentationParams::kNumSegments][VP9_FRAME_MAX]
-             [kNumModeDeltas];
+  std::array<std::array<std::array<uint8_t, kNumModeDeltas>, VP9_FRAME_MAX>, Vp9SegmentationParams::kNumSegments> lvl;
 };
 
 // Members of Vp9FrameHeader will be 0-initialized by Vp9Parser::ParseNextFrame.
@@ -222,8 +220,8 @@ struct MEDIA_EXPORT Vp9FrameHeader {
   bool intra_only = false;
   uint8_t reset_frame_context = 0;
   uint8_t refresh_frame_flags = 0;
-  uint8_t ref_frame_idx[kVp9NumRefsPerFrame] = {};
-  bool ref_frame_sign_bias[Vp9RefType::VP9_FRAME_MAX] = {false};
+  std::array<uint8_t, kVp9NumRefsPerFrame> ref_frame_idx = {};
+  std::array<bool, Vp9RefType::VP9_FRAME_MAX> ref_frame_sign_bias = {false};
   bool allow_high_precision_mv = false;
   Vp9InterpolationFilter interpolation_filter{Vp9InterpolationFilter::EIGHTTAP};
 
@@ -309,7 +307,7 @@ class MEDIA_EXPORT Vp9Parser {
     Vp9LoopFilterParams loop_filter_;
 
     // Frame references.
-    ReferenceSlot ref_slots_[kVp9NumRefFrames];
+    std::array<ReferenceSlot, kVp9NumRefFrames> ref_slots_;
   };
 
   // Stores start pointer and size of each frame within the current superframe.
diff --git a/media/parsers/vp9_uncompressed_header_parser.cc b/media/parsers/vp9_uncompressed_header_parser.cc
index cb45d668f45a6..da07458f4ed44 100644
--- a/media/parsers/vp9_uncompressed_header_parser.cc
+++ b/media/parsers/vp9_uncompressed_header_parser.cc
@@ -7,6 +7,7 @@
 #include <array>
 #include <type_traits>
 
+#include "base/containers/auto_spanification_helper.h"
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/numerics/safe_conversions.h"
@@ -774,10 +775,9 @@ Vp9InterpolationFilter Vp9UncompressedHeaderParser::ReadInterpolationFilter() {
 }
 
 void Vp9UncompressedHeaderParser::SetupPastIndependence(Vp9FrameHeader* fhdr) {
-  UNSAFE_TODO(
-      memset(&context_->segmentation_, 0, sizeof(context_->segmentation_)));
-  UNSAFE_TODO(
-      memset(fhdr->ref_frame_sign_bias, 0, sizeof(fhdr->ref_frame_sign_bias)));
+  UNSAFE_TODO(memset(&context_->segmentation_, 0,
+                       sizeof(context_->segmentation_)));
+  std::ranges::fill(fhdr->ref_frame_sign_bias, false);
 
   ResetLoopfilter();
   fhdr->frame_context = kVp9DefaultFrameContext;
@@ -926,8 +926,7 @@ void Vp9UncompressedHeaderParser::ResetLoopfilter() {
   loop_filter.ref_deltas[VP9_FRAME_GOLDEN] = -1;
   loop_filter.ref_deltas[VP9_FRAME_ALTREF] = -1;
 
-  UNSAFE_TODO(
-      memset(loop_filter.mode_deltas, 0, sizeof(loop_filter.mode_deltas)));
+  std::ranges::fill(loop_filter.mode_deltas, 0);
 }
 
 // 6.2 Uncompressed header syntax
@@ -1011,7 +1010,7 @@ bool Vp9UncompressedHeaderParser::Parse(const uint8_t* stream,
     } else {
       fhdr->refresh_frame_flags = reader_.ReadLiteral(8);
 
-      static_assert(std::extent<decltype(fhdr->ref_frame_sign_bias)>() >=
+      static_assert(std::tuple_size<decltype(fhdr->ref_frame_sign_bias)>() >=
                         Vp9RefType::VP9_FRAME_LAST + kVp9NumRefsPerFrame,
                     "ref_frame_sign_bias is not big enough");
       for (size_t i = 0; i < kVp9NumRefsPerFrame; i++) {
