[BUG] UDP and TCP dies at the master HEAD #857

Closed
opened 2026-01-29 16:55:28 +00:00 by claunia · 1 comment
Owner

Originally created by @syehoonkim on GitHub (Dec 19, 2025).

Dear,
After pulling repo I built the ccextractorwinfull.exe by MSVC.
But I failed to make it listen to UDP/TCP both.
I ran

ccextractorwinfull.exe --udp 54321

But it dies. Even without any error messages:

D:\repos\ccextractor\windows\x64\Debug-Full>ccextractorwinfull.exe --udp 54321
CCExtractor 0.95, Carlos Fernandez Sanz, Volker Quetschke.
Teletext portions taken from Petr Kutalek's telxcc
--------------------------------------------------------------------------
Input: Network, UDP/54321
[Extract: 1] [Stream mode: Autodetect]
[Program : Auto ] [Hauppage mode: No] [Use MythTV code: Auto]
[CEA-708: 63 decoders active]
[CEA-708: using charset "none" for all services]
[Timing mode: Auto] [Debug: No] [Buffer input: Yes]
[Use pic_order_cnt_lsb for H.264: No] [Print CC decoder traces: No]
[Target format: .srt] [Encoding: UTF-8] [Delay: 0] [Trim lines: No]
[Add font color data: Yes] [Add font typesetting: Yes]
[Convert case: No][Filter profanity: No] [Video-edit join: No]
[Extraction start time: not set (from start)]
[Extraction end time: not set (to end)]
[Live stream: No] [Clock frequency: 90000]
[Teletext page: Autodetect]
[Start credits text: None]
[Quantisation-mode: None]
[Tesseract PSM: 3]

D:\repos\ccextractor\windows\x64\Debug-Full>

Same thing happens with TCP.
I checked that no process is listening to UDP/TCP port 54321.
How can I solve this?

Originally created by @syehoonkim on GitHub (Dec 19, 2025). Dear, After pulling repo I built the ccextractorwinfull.exe by MSVC. But I failed to make it listen to UDP/TCP both. I ran ``` ccextractorwinfull.exe --udp 54321 ``` But it dies. Even without any error messages: ``` D:\repos\ccextractor\windows\x64\Debug-Full>ccextractorwinfull.exe --udp 54321 CCExtractor 0.95, Carlos Fernandez Sanz, Volker Quetschke. Teletext portions taken from Petr Kutalek's telxcc -------------------------------------------------------------------------- Input: Network, UDP/54321 [Extract: 1] [Stream mode: Autodetect] [Program : Auto ] [Hauppage mode: No] [Use MythTV code: Auto] [CEA-708: 63 decoders active] [CEA-708: using charset "none" for all services] [Timing mode: Auto] [Debug: No] [Buffer input: Yes] [Use pic_order_cnt_lsb for H.264: No] [Print CC decoder traces: No] [Target format: .srt] [Encoding: UTF-8] [Delay: 0] [Trim lines: No] [Add font color data: Yes] [Add font typesetting: Yes] [Convert case: No][Filter profanity: No] [Video-edit join: No] [Extraction start time: not set (from start)] [Extraction end time: not set (to end)] [Live stream: No] [Clock frequency: 90000] [Teletext page: Autodetect] [Start credits text: None] [Quantisation-mode: None] [Tesseract PSM: 3] D:\repos\ccextractor\windows\x64\Debug-Full> ``` Same thing happens with TCP. I checked that no process is listening to UDP/TCP port 54321. How can I solve this?
Author
Owner

@syehoonkim commented on GitHub (Dec 19, 2025):

I debugged and found it dies at

//c_str.rs
    pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
        // SAFETY: The caller has provided a pointer that points to a valid C
        // string with a NUL terminator less than `isize::MAX` from `ptr`.
        let len = unsafe { strlen(ptr) };

which is called from

//demuxers.rs
pub unsafe extern "C" fn ccxr_demuxer_open(ctx: *mut ccx_demuxer, file: *const c_char) -> c_int {
    if ctx.is_null() {
        return -1;
    }
    let c_str = CStr::from_ptr(file);
    let file_str = match c_str.to_str() {
        Ok(s) => s,
        Err(_) => return -1,
    };

    let mut demux_ctx = copy_demuxer_from_c_to_rust(ctx);
    let mut CcxOptions: Options = copy_to_rust(&raw const ccx_options);

    let ReturnValue = demux_ctx.open(file_str, &mut CcxOptions);

    copy_from_rust(&raw mut ccx_options, CcxOptions);
    copy_demuxer_from_rust_to_c(ctx, &demux_ctx);
    ReturnValue
}

I guess that if --udp option is gave, ccxr_demuxer_open should not try to read file, so it should be somewhat like

pub unsafe extern "C" fn ccxr_demuxer_open(ctx: *mut ccx_demuxer, file: *const c_char) -> c_int {
    if ctx.is_null() {
        return -1;
    }

    let file_str = if !file.is_null() {
        match CStr::from_ptr(file).to_str() {
            Ok(s) => s,
            Err(_) => return -1,
        }
    } else {
        ""
    };

    let mut demux_ctx = copy_demuxer_from_c_to_rust(ctx);
    let mut CcxOptions: Options = copy_to_rust(&raw const ccx_options);

    let ReturnValue: i32 = demux_ctx.open(file_str, &mut CcxOptions);

    copy_from_rust(&raw mut ccx_options, CcxOptions);
    copy_demuxer_from_rust_to_c(ctx, &demux_ctx);
    ReturnValue
}

Thank you.

@syehoonkim commented on GitHub (Dec 19, 2025): I debugged and found it dies at ``` //c_str.rs pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr { // SAFETY: The caller has provided a pointer that points to a valid C // string with a NUL terminator less than `isize::MAX` from `ptr`. let len = unsafe { strlen(ptr) }; ``` which is called from ``` //demuxers.rs pub unsafe extern "C" fn ccxr_demuxer_open(ctx: *mut ccx_demuxer, file: *const c_char) -> c_int { if ctx.is_null() { return -1; } let c_str = CStr::from_ptr(file); let file_str = match c_str.to_str() { Ok(s) => s, Err(_) => return -1, }; let mut demux_ctx = copy_demuxer_from_c_to_rust(ctx); let mut CcxOptions: Options = copy_to_rust(&raw const ccx_options); let ReturnValue = demux_ctx.open(file_str, &mut CcxOptions); copy_from_rust(&raw mut ccx_options, CcxOptions); copy_demuxer_from_rust_to_c(ctx, &demux_ctx); ReturnValue } ``` I guess that if --udp option is gave, ccxr_demuxer_open should not try to read file, so it should be somewhat like ``` pub unsafe extern "C" fn ccxr_demuxer_open(ctx: *mut ccx_demuxer, file: *const c_char) -> c_int { if ctx.is_null() { return -1; } let file_str = if !file.is_null() { match CStr::from_ptr(file).to_str() { Ok(s) => s, Err(_) => return -1, } } else { "" }; let mut demux_ctx = copy_demuxer_from_c_to_rust(ctx); let mut CcxOptions: Options = copy_to_rust(&raw const ccx_options); let ReturnValue: i32 = demux_ctx.open(file_str, &mut CcxOptions); copy_from_rust(&raw mut ccx_options, CcxOptions); copy_demuxer_from_rust_to_c(ctx, &demux_ctx); ReturnValue } ``` Thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#857