WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#22824 closed defect (bug) (fixed)

multi_resize can cause fatal if individual _save(s) fail

Reported by: dh-shredder Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: critical Version: 3.5
Component: Media Keywords: has-patch
Focuses: Cc:

Description

multi_resize is not properly checking for WP_Error after a save before dereferencing the metadata returned from _save(). This can cause a fatal error (due to dereferencing a WP_Error) if one of the individual saves fails.

This is a regression to the previous behavior in 3.4.2

Patch attached fixes this by moving the array access/unset into the ! is_wp_error() check.

Attachments (1)

22824.diff (1.2 KB) - added by dh-shredder 9 years ago.

Download all attachments as: .zip

Change History (6)

@dh-shredder
9 years ago

#1 @nacin
9 years ago

  • Milestone changed from Awaiting Review to 3.5
  • Severity changed from major to critical

#2 @markoheijnen
9 years ago

Looked and tested the patch and it's good

#3 @dh-shredder
9 years ago

  • Cc dh-shredder added

We could also get rid of the && $resized, since we're guaranteed to receive either an array or WP_Error from _save() in both classes, but left it the way it was to avoid additional logic churn.

#4 @nacin
9 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 23133:

Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.

#5 @nacin
9 years ago

In 23136:

Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.

Merges [23133] to the 3.5 branch.

Note: See TracTickets for help on using tickets.