diff --git a/modules/image/image.module b/modules/image/image.module
index fcbf62c..956f8b7 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -845,6 +845,14 @@ function image_style_deliver($style, $scheme) {
     }
   }
 
+  // Confirm that the original source image exists before trying to process it.
+  if (!is_file($image_uri)) {
+    watchdog('image', 'Source image at %source_image_path not found while trying to generate derivative image at %derivative_path.',  array('%source_image_path' => $image_uri, '%derivative_path' => $derivative_uri));
+    drupal_add_http_header('Status', '404 Not Found');
+    print t('Error generating image.');
+    drupal_exit();
+  }
+
   // Don't start generating the image if the derivative already exists or if
   // generation is in progress in another thread.
   $lock_name = 'image_style_deliver:' . $style['name'] . ':' . drupal_hash_base64($image_uri);
diff --git a/modules/image/image.test b/modules/image/image.test
index 59fc77d..46831e4 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -140,6 +140,16 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
   }
 
   /**
+   * Test that an invalid source image returns a 404.
+   */
+  function testImageStyleUrlForMissingSourceImage() {
+    $non_existent_uri = 'public://foo.png';
+    $generated_url = image_style_url($this->style_name, $non_existent_uri);
+    $this->drupalGet($generated_url);
+    $this->assertResponse(404, 'Accessing an image style URL with a source image that does not exist provides a 404 error response.');
+  }
+
+  /**
    * Test image_style_url() with a file using the "public://" scheme.
    */
   function testImageStyleUrlAndPathPublic() {
