Commit 0f2d66d260 for aom

commit 0f2d66d260b21f4ca7f4c2d33bd404302de8a6ad
Author: Marco Paniconi <marpan@google.com>
Date:   Thu Dec 4 16:57:35 2025 -0800

    Return error log for issue b:457951958

    Crash happens for speed 6 realtime encoding, and
    points to mi being NULL or mi->bsize being invalid in
    av1_update_state(). Add check and return codec_error if
    mi == NULL in av1_update_state().

    The check for (mi != NULL) is already done in the parent
    functions where the pc_tree is allocated, but add the
    additional check here to be sure.

    Also use bsize instead of mi->bsize for the array
    mi_size_width/height[].

    Bug: b:457951958
    Change-Id: I80f3a3c1ea90d67e08017c3a4eaa13bb18ff811b

diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c
index b296dbaaab..2b0495e240 100644
--- a/av1/encoder/encodeframe_utils.c
+++ b/av1/encoder/encodeframe_utils.c
@@ -182,12 +182,18 @@ void av1_update_state(const AV1_COMP *const cpi, ThreadData *td,
   struct macroblock_plane *const p = x->plane;
   struct macroblockd_plane *const pd = xd->plane;
   const MB_MODE_INFO *const mi = &ctx->mic;
+  if (mi == NULL) {
+    aom_internal_error(cm->error, AOM_CODEC_ERROR,
+                       "mi is NULL in av1_update_state: %d %d %d %d \n",
+                       cm->current_frame.frame_type, cm->width, cm->height,
+                       bsize);
+  }
   MB_MODE_INFO *const mi_addr = xd->mi[0];
   const struct segmentation *const seg = &cm->seg;
   assert(bsize < BLOCK_SIZES_ALL);
-  assert(mi != NULL && mi->bsize == bsize);
-  const int bw = mi_size_wide[mi->bsize];
-  const int bh = mi_size_high[mi->bsize];
+  assert(mi->bsize == bsize);
+  const int bw = mi_size_wide[bsize];
+  const int bh = mi_size_high[bsize];
   const int mis = mi_params->mi_stride;
   const int mi_width = mi_size_wide[bsize];
   const int mi_height = mi_size_high[bsize];