Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix regex bug #1171

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

fix regex bug #1171

wants to merge 4 commits into from

Conversation

wawava
Copy link

@wawava wawava commented Jul 3, 2017

when prts_closure num > 4,pt_error can't enough to use ,and pt_error don't store new prts_closure, when need back ,will error

when prts_closure num > 4,pt_error can't enough to use ,and pt_error don't store new prts_closure,  when need back ,will error
@ddpbsd
Copy link
Member

ddpbsd commented Jul 5, 2017

3 of the test builds failed, can you look into that and try to fix it?

@ddpbsd
Copy link
Member

ddpbsd commented Jul 6, 2017

I am also seeing these warnings:

os_regex/os_regex_execute.c: In function __OS_Regex_:
os_regex/os_regex_execute.c:273:47: warning: assignment discards _const_ qualifier from pointer target type [enabled by default]
                             pt_error[pt_size] = pt;
                                               ^
os_regex/os_regex_execute.c:274:51: warning: assignment discards _const_ qualifier from pointer target type [enabled by default]
                             pt_error_str[pt_size] = st;
                                                   ^

@wawava
Copy link
Author

wawava commented Jul 12, 2017

@ddpbsd hi ddpbsd
i'm mod makefile and os_regex_execute.c file ,complie on local machine,now have error in make run_tests, see the test_os_xml.c will open invalid_file.inv file ,but i can't find the file in anywhere, can help me how to test it,thx

Running suite(s): os_zlib
100%: Checks: 9, Failures: 0, Errors: 0
Running suite(s): os_xml
97%: Checks: 44, Failures: 1, Errors: 0
tests/test_os_xml.c:278:F:Core:test_invalidfile:0: Assertion 'xml.err == "XMLERR: File 'invalid_file.inv' not found."' failed: xml.err == "XMLERR: File 'invalid_file.inv' not found errno = 2.", "XMLERR: File 'invalid_file.inv' not found." == "XMLERR: File 'invalid_file.inv' not found."
Makefile:1152: recipe for target 'run_tests' failed
make: *** [run_tests] Error 1

fix memory free bug
@ddpbsd
Copy link
Member

ddpbsd commented Jul 15, 2017

Without looking at it enough, I don't think it's supposed to find that file:

START_TEST(test_invalidfile)
{
    OS_XML xml;
    ck_assert_int_ne(OS_ReadXML("invalid_file.inv", &xml), 0);
    ck_assert_str_eq(xml.err, "XMLERR: File 'invalid_file.inv' not found.");
    ck_assert_int_eq(xml.err_line, 0);

    OS_ClearXML(&xml);
}
END_TEST

I don't know enough about these tests to know how to fix it off hand, and I'm not seeing problems with it.
I am seeing plenty of other issues though:

    CC os_regex/os_regex_execute.o
In file included from os_regex/os_regex_execute.c:10:0:
os_regex/os_regex_execute.c: In function __OS_Regex_:
os_regex/os_regex_execute.c:425:29: warning: passing argument 1 of _free_ discards _const_ qualifier from pointer target type [-Wdiscarded-qualifiers]
                     os_free(pt_error[pt_size]);
                             ^
./headers/shared.h:173:29: note: in definition of macro _os_free_
 #define os_free(x) (x)?free(x):merror("free a null")
                             ^
In file included from ./headers/shared.h:56:0,
                 from os_regex/os_regex_execute.c:10:
/usr/include/stdlib.h:483:13: note: expected _void *_ but argument is of type _const char *_
 extern void free (void *__ptr) __THROW;
             ^
In file included from os_regex/os_regex_execute.c:10:0:
os_regex/os_regex_execute.c:438:29: warning: passing argument 1 of _free_ discards _const_ qualifier from pointer target type [-Wdiscarded-qualifiers]
                     os_free(pt_error_str[pt_size]);
                             ^
./headers/shared.h:173:29: note: in definition of macro _os_free_
 #define os_free(x) (x)?free(x):merror("free a null")
                             ^
In file included from ./headers/shared.h:56:0,
                 from os_regex/os_regex_execute.c:10:
/usr/include/stdlib.h:483:13: note: expected _void *_ but argument is of type _const char *_
 extern void free (void *__ptr) __THROW;
             ^

And later:

Running suite(s): os_xml
100%: Checks: 44, Failures: 0, Errors: 0
Running suite(s): os_regex
90%: Checks: 30, Failures: 0, Errors: 3
tests/test_os_regex.c:161:E:Regex:test_success_regex1:0: (after this point) Received signal 6 (Aborted)
tests/test_os_regex.c:201:E:Regex:test_fail_regex1:0: (after this point) Received signal 11 (Segmentation fault)
tests/test_os_regex.c:389:E:RegexExtraction:test_regexextraction:0: (after this point) Received signal 11 (Segmentation fault)
Makefile:1142: recipe for target 'run_tests' failed
make[1]: *** [run_tests] Error 1
make[1]: Leaving directory '/home/ddp/ossec-hids/src'
Makefile:1139: recipe for target 'test' failed
make: *** [test] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants