From 2642a446b30d5ed66f25accd1d540f61059e15bf Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Tue, 2 Feb 2021 04:27:06 +0000 Subject: [PATCH] Media: Sanity check image meta in 'wp_image_src_get_dimensions'. This fixes a potential illegal offset error introduced in [50134] if the `$image_meta` doesn't include a `file` key. Props dd32. Fixes #51865. Built from https://develop.svn.wordpress.org/trunk@50136 git-svn-id: http://core.svn.wordpress.org/trunk@49815 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 5 ++++- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 42b3e23363..088e6868c7 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1602,7 +1602,10 @@ function wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = $dimensions = false; // Is it a full size image? - if ( strpos( $image_src, $image_meta['file'] ) !== false ) { + if ( + isset( $image_meta['file'] ) && + strpos( $image_src, $image_meta['file'] ) !== false + ) { $dimensions = array( (int) $image_meta['width'], (int) $image_meta['height'], diff --git a/wp-includes/version.php b/wp-includes/version.php index ea7f042b19..e38f07d6d3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-50135'; +$wp_version = '5.7-alpha-50136'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.