Issue #149 - avoid crash on null attr value
This commit is contained in:
parent
d38c5c5d78
commit
698396eaa0
10
src/attrs.c
10
src/attrs.c
|
@ -965,13 +965,15 @@ static void FreeAnchor(TidyDocImpl* doc, Anchor *a)
|
||||||
|
|
||||||
static uint anchorNameHash(ctmbstr s)
|
static uint anchorNameHash(ctmbstr s)
|
||||||
{
|
{
|
||||||
uint hashval;
|
uint hashval = 0;
|
||||||
|
/* Issue #149 - an inferred name can be null. avoid crash */
|
||||||
for (hashval = 0; *s != '\0'; s++) {
|
if (s)
|
||||||
|
{
|
||||||
|
for ( ; *s != '\0'; s++) {
|
||||||
tmbchar c = TY_(ToLower)( *s );
|
tmbchar c = TY_(ToLower)( *s );
|
||||||
hashval = c + 31*hashval;
|
hashval = c + 31*hashval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return hashval % ANCHOR_HASH_SIZE;
|
return hashval % ANCHOR_HASH_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue