Skip to content

DecodeImage is causing my program to exit #1094

Description

@ca5446001-tech

In operators/vision/image_decoder.hpp there is this line:

# operators/vision/image_decoder.hpp : 137
cinfo.err = jpeg_std_error(&jerr); // sets what happens when libjpg has an error

The problem with this is that now cinfo.err() will call exit:

# libjpeg/src/jerror.c : 66
METHODDEF(void)
error_exit(j_common_ptr cinfo)
{
  /* Always display the message */
  (*cinfo->err->output_message) (cinfo);

  /* Let the memory manager delete any temp files before we die */
  jpeg_destroy(cinfo);

  exit(EXIT_FAILURE);
}

Now, I have data being fed to generic models, and in this case when the data is invalid and given to an ImageDecoder node, my entire program just exits, instead of having an OrtStatus being returned.

I am running this with onnxruntime C api and usually models will just return an OrtStatus when they have an error. So I'm wondering if there is a workaround for this s.t. invalid images don't crash my program.

If this were to be changed, it could be that some other function that is not jpeg_std_error is used, s.t. cinfo.err doesn't call error_exit(), but instead sets an OrtStatus.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions