Opened 13 years ago

Closed 13 years ago

#218 closed defect (fixed)

Bug in hash table when key is PJ_HASH_KEY_STRING and hval is specified (thanks ChenHuan)

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-0.5.10.3
Component: pjlib Version: 0.5.10.2
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description

To reproduce:

    char *key = "hello";
    unsigned hval = 12345;
    pj_hash_set(pool, ht, key, PJ_HASH_KEY_STRING, hval, 1);
    pj_hash_set(pool, ht, key, PJ_HASH_KEY_STRING, hval, 2);

Upon second pj_hash_set() invocation, the function will crash because when hval is specified the key length is not calculated, causing memcmp() to be called with -1 argument.

Note that this does not affect PJSIP since PJSIP never uses PJ_HASH_KEY_STRING.

Thanks ChenHuan <chenhuan at sict.ac.cn>.

Change History (1)

comment:1 Changed 13 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from Bug in hash table when key is PJ_HASH_KEY_STRING and hval is specified (thanks !ChenHuan) to Bug in hash table when key is PJ_HASH_KEY_STRING and hval is specified (thanks ChenHuan)

Fixed in r1185.

Note: See TracTickets for help on using tickets.