Bug 1901955 - Segment fault when call log4c_init twice.
Summary: Segment fault when call log4c_init twice.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: log4c
Version: epel7
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: František Dvořák
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-26 13:29 UTC by lexand
Modified: 2021-03-28 02:04 UTC (History)
3 users (show)

Fixed In Version: log4c-1.2.4-2.el7
Clone Of:
Environment:
Last Closed: 2021-03-28 02:04:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description lexand 2020-11-26 13:29:46 UTC
Description of problem:
Segment fault when call log4c_init twice.

Version-Release number of selected component (if applicable):
1.2.4

How reproducible:


Steps to Reproduce:
1. call log4c_init
2. call log4c_fini
3. call log4c_init

Actual results:
Step 3 run sucessfully.

Expected results:
Segment fault & core dump

Additional info:
The code is below:
static sd_hash_t* log4c_layout_types(void)
{
    static sd_hash_t* types = NULL;

    if (!types)
	types = sd_hash_new(20, NULL);
    
    return types;
}

extern void log4c_layout_types_free( void ) {
	sd_hash_t * types = log4c_layout_types();
	if ( types != NULL ) {
		sd_hash_delete( types );
	}
}
"types" in function log4c_layout_types_free has delete, but the pointer need to be set to nullptr.
It need to change to code below:

static sd_hash_t* types = NULL;
static sd_hash_t* log4c_layout_types(void)
{
    if (!types)
	types = sd_hash_new(20, NULL);
    
    return types;
}

extern void log4c_layout_types_free( void ) {
    //sd_hash_t * types = log4c_layout_types();
    if ( types != NULL ) {
        sd_hash_delete( types );
    }
types = NULL;
}

The bug is existed in all packages, neither Fedora EPEL or EPEL for RHEL, in verison 1.2.4。

Comment 1 Steve Traylen 2021-03-08 10:09:55 UTC
Bug in rawhide also.

Comment 2 Fedora Update System 2021-03-13 18:40:53 UTC
FEDORA-EPEL-2021-0afde3da1b has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-0afde3da1b

Comment 3 Fedora Update System 2021-03-13 21:51:49 UTC
FEDORA-EPEL-2021-0afde3da1b has been pushed to the Fedora EPEL 7 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-0afde3da1b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 lexand 2021-03-22 08:49:50 UTC
Conrect:
Expected results:
Step 3 run sucessfully.

Actual results:
Segment fault & core dump

And this BUG is also appeared in epel6 & epel8. They should be fixed anyway.

Comment 5 František Dvořák 2021-03-22 09:24:46 UTC
For EPEL7, the fix is in the testing repository.

Fedora branches and EPEL8 should be OK.

Comment 6 Fedora Update System 2021-03-28 02:04:38 UTC
FEDORA-EPEL-2021-0afde3da1b has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.