diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index a61d9e5f..cc68413b 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -4,6 +4,7 @@ - Optimize: Remove multiple RGB to grey conversion in OCR. - Fix: Update UTF8Proc to 2.2.0 - Fix: Warn instead of fatal when a 0xFF marker is missing +- Fix: Segfault in general_loop.c because of enc_ctx is NULL pointer 0.87 (2018-10-23) ----------------- diff --git a/src/lib_ccx/general_loop.c b/src/lib_ccx/general_loop.c index d2190530..87b93df7 100644 --- a/src/lib_ccx/general_loop.c +++ b/src/lib_ccx/general_loop.c @@ -1025,14 +1025,17 @@ int general_loop(struct lib_ccx_ctx *ctx) if (data_node->bufferdatatype == CCX_TELETEXT && dec_ctx->private_data) //if we have teletext subs, we set the min_pts here set_tlt_delta(dec_ctx, min_pts); ret = process_data(enc_ctx, dec_ctx, data_node); - if (enc_ctx->srt_counter || enc_ctx->cea_708_counter || dec_ctx->saw_caption_block || ret == 1) - caps = 1; + if (enc_ctx != NULL) { + if (enc_ctx->srt_counter || enc_ctx->cea_708_counter || dec_ctx->saw_caption_block || ret == 1) + caps = 1; + } // Process the last subtitle for DVB if (!(!terminate_asap && !end_of_file && is_decoder_processed_enough(ctx) == CCX_FALSE)) { if (data_node->bufferdatatype == CCX_DVB_SUBTITLE && dec_ctx->dec_sub.prev->end_time == 0) { dec_ctx->dec_sub.prev->end_time = (dec_ctx->timing->current_pts - dec_ctx->timing->min_pts) / (MPEG_CLOCK_FREQ / 1000); - encode_sub(enc_ctx->prev, dec_ctx->dec_sub.prev); + if (enc_ctx != NULL) + encode_sub(enc_ctx->prev, dec_ctx->dec_sub.prev); dec_ctx->dec_sub.prev->got_output = 0; } } @@ -1104,16 +1107,19 @@ int general_loop(struct lib_ccx_ctx *ctx) set_current_pts(dec_ctx->timing, data_node->pts); ret = process_data(enc_ctx, dec_ctx, data_node); - if ( + if (enc_ctx != NULL){ + if ( (enc_ctx && (enc_ctx->srt_counter || enc_ctx->cea_708_counter) || dec_ctx->saw_caption_block || ret == 1) ) caps = 1; + } // Process the last subtitle for DVB if (!(!terminate_asap && !end_of_file && is_decoder_processed_enough(ctx) == CCX_FALSE)) { if (data_node->bufferdatatype == CCX_DVB_SUBTITLE && dec_ctx && dec_ctx->dec_sub.prev && dec_ctx->dec_sub.prev->end_time == 0) { dec_ctx->dec_sub.prev->end_time = (dec_ctx->timing->current_pts - dec_ctx->timing->min_pts) / (MPEG_CLOCK_FREQ / 1000); - encode_sub(enc_ctx->prev, dec_ctx->dec_sub.prev); + if (enc_ctx != NULL) + encode_sub(enc_ctx->prev, dec_ctx->dec_sub.prev); dec_ctx->dec_sub.prev->got_output = 0; } }