Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8094220

javafx.scene.image.Image() constructor may hangs on corrupted image

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u60
    • 8
    • javafx
    • Win 7, b66

      javafx.scene.image.Image() constructor hangs (infinite loop?) on some corrupted images

      Sample code (image is attached):

      import java.io.FileInputStream;
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.image.Image;
      import javafx.scene.image.ImageView;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class Main extends Application {
          public static void main(String[] args) {
              launch();
          }
          @Override
          public void start(Stage stage) throws Exception {
              FileInputStream input_byte_stream = new FileInputStream("corrupted_image.png");
              Image image = new Image(input_byte_stream);
              HBox pane = new HBox();
              ImageView view = new ImageView(image);
              pane.getChildren().add(view);
              Scene scene = new Scene(pane, 1024, 1024);
              stage.setScene(scene);
              stage.show();
          }
      }

            vadim Vadim Pakhnushev
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: