Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
None
-
None
Description
The following piece of code crashes unexpectedly: Note that ops count is one, but it tries to read a second op.
for (hi = axis2_hash_first (svc_map, &env);
NULL != hi; hi = axis2_hash_next (&env, hi))
{
axis2_hash_t *ops= NULL;
axis2_hash_this(hi, NULL, NULL, &service);
ops = AXIS2_SVC_GET_OPS(((axis2_svc_t *)service), &env);
if(ops)
{
printf("ops count = %d\n", axis2_hash_count(ops));
axis2_hash_index_t *hi2 = NULL;
void *op = NULL;
axis2_char_t *oname = NULL;
int count = 0;
for(hi2 = axis2_hash_first(ops, &env); hi2; axis2_hash_next(&env, hi2))
{
printf ("count = %d \n", count++);
if (!hi2)
break;
axis2_hash_this(hi2, NULL, NULL, &op);
if (op)
}
}
else
printf("ops count = zero\n");
}
Output & gdb trace:
message receiver loaded successfully
stat:1
No files in this directory:/home/samisa/axis2/c/deploy/modules/
fname:libecho.so
dep_engine:size:1
type:0
file_name:libecho.so
svcs_xml:/home/samisa/axis2/c/deploy/services/services.xml
root_element_name:service
name*:libecho.so
svc_name:echo
message receiver loaded successfully
svc_name:echo
svc_grp_name:echo
respos listner init status:1
svc_map count = 1
ops count = 1
count = 0
op name = echo
count = 1
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208227360 (LWP 8228)]
0x00d1b3f4 in axis2_hash_this (hi=0x869e510, key=0x0, klen=0x0, val=0xbf9db290) at hash.c:166
166 *val = (void *) hi->this->val;
(gdb) bt
#0 0x00d1b3f4 in axis2_hash_this (hi=0x869e510, key=0x0, klen=0x0, val=0xbf9db290) at hash.c:166
#1 0x08048bab in axis2_test_dep_engine_load () at test_deployment.c:70
#2 0x08048eed in main () at test_deployment.c:218
(gdb)
Note that ops count is one, but it tries to read a second op.