Browse Source

!6957 [MD] minddata catch jpeg err exi runtime_error

Merge pull request !6957 from xiefangqi/md_catch_jpeg_errexit
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
c90652ab8b
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc

+ 7
- 1
mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc View File

@@ -161,7 +161,13 @@ static void JpegInitSource(j_decompress_ptr cinfo) {}


static boolean JpegFillInputBuffer(j_decompress_ptr cinfo) { static boolean JpegFillInputBuffer(j_decompress_ptr cinfo) {
if (cinfo->src->bytes_in_buffer == 0) { if (cinfo->src->bytes_in_buffer == 0) {
ERREXIT(cinfo, JERR_INPUT_EMPTY);
// Under ARM platform raise runtime_error may cause core problem,
// so we catch runtime_error and just return FALSE.
try {
ERREXIT(cinfo, JERR_INPUT_EMPTY);
} catch (std::runtime_error &e) {
return FALSE;
}
return FALSE; return FALSE;
} }
return TRUE; return TRUE;


Loading…
Cancel
Save