[ 
https://issues.apache.org/jira/browse/DISPATCH-928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16367815#comment-16367815
 ] 

Gordon Sim commented on DISPATCH-928:
-------------------------------------

Not sure if this is the right fix, but it does avoid the segfault:

{noformat}
diff --git a/src/router_core/route_tables.c b/src/router_core/route_tables.c
index 86a7aa4..ce46c81 100644
--- a/src/router_core/route_tables.c
+++ b/src/router_core/route_tables.c
@@ -576,6 +576,7 @@ static void qdr_map_destination_CT(qdr_core_t *core, 
qdr_action_t *action, bool
         qd_hash_retrieve(core->addr_hash, iter, (void**) &addr);
         if (!addr) {
             addr = qdr_address_CT(core, 
qdr_treatment_for_address_hash_CT(core, iter));
+            if (!addr) break;
             qd_hash_insert(core->addr_hash, iter, addr, &addr->hash_handle);
             DEQ_ITEM_INIT(addr);
             DEQ_INSERT_TAIL(core->addrs, addr);
{noformat}

> calling map_destination for 'undefined' address causes segfault
> ---------------------------------------------------------------
>
>                 Key: DISPATCH-928
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-928
>             Project: Qpid Dispatch
>          Issue Type: Bug
>            Reporter: Gordon Sim
>            Priority: Major
>
> If qdr_map_destination_CT is called for an address that has not been defined 
> on a router that has the default distribution set to 'undefined', 
> qdr_address_CT (line 578 at present) returns null. However there is no check 
> for this and the address is used to get a hash_handle which causes a segfault.
> Under valgrind you see:
> {noformat}
> ==10232== Invalid write of size 8
> ==10232==    at 0x4E67501: qd_hash_internal_insert (hash.c:156)
> ==10232==    by 0x4E6756B: qd_hash_insert (hash.c:168)
> ==10232==    by 0x4E91644: qdr_map_destination_CT (route_tables.c:579)
> ==10232==    by 0x4E8F80D: router_core_thread (router_core_thread.c:83)
> ==10232==    by 0x550F739: start_thread (in /usr/lib64/libpthread-2.24.so)
> ==10232==    by 0x607AE7E: clone (in /usr/lib64/libc-2.24.so)
> ==10232==  Address 0x98 is not stack'd, malloc'd or (recently) free'd
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to