while (true)
{
position = Fnext_char_property_change (position, limit);
if (XFIXNAT (position) >= XFIXNAT (limit))
{
position = limit;
break;
}
value = Fget_char_property (position, prop, object);
if (!EQ (value, initial_value))
break;
}
If it gets a LIMIT larger than point-max, position can never == limit, so it will loop in the while loop infinitely. I would add a check in the beginning of the function, to signal an out-of-range error. Or maybe set limit to poin-max quietly. Other similar functions could have the same problem, previous-single-char-property-change comes to my mind.