diff --git a/libde265/decctx.cc b/libde265/decctx.cc index 223a6aaf..350f7e7a 100644 --- a/libde265/decctx.cc +++ b/libde265/decctx.cc @@ -582,16 +582,17 @@ de265_error decoder_context::read_pps_NAL(bitreader& reader) std::shared_ptr new_pps = std::make_shared(); bool success = new_pps->read(&reader,this); + if (!success) { + return DE265_WARNING_PPS_HEADER_INVALID; + } if (param_pps_headers_fd>=0) { new_pps->dump(param_pps_headers_fd); } - if (success) { - pps[ (int)new_pps->pic_parameter_set_id ] = new_pps; - } + pps[ (int)new_pps->pic_parameter_set_id ] = new_pps; - return success ? DE265_OK : DE265_WARNING_PPS_HEADER_INVALID; + return DE265_OK; } de265_error decoder_context::read_sei_NAL(bitreader& reader, bool suffix)