Index: src/wp-admin/includes/media.php
===================================================================
--- src/wp-admin/includes/media.php	(revision 32928)
+++ src/wp-admin/includes/media.php	(working copy)
@@ -844,6 +844,9 @@
 		// Set variables for storage, fix file filename for query strings.
 		preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
 		$file_array = array();
+		if ( ! isset( $matches[0] ) ) {
+			return new WP_Error( 'image_sideload_failed', __( 'Invalid Image URL' ) );
+		}
 		$file_array['name'] = basename( $matches[0] );
 
 		// Download file to temp location.
