• Nick Wellnhofer's avatar
    Fix pathological performance when outputting charrefs · e5107772
    Nick Wellnhofer authored
    If a character can't be represented in the output encoding, it is
    converted to a character reference. This used to to replace the
    character in the input stream by calling xmlBufAddHead or
    xmlBufferAddHead. These functions shifted the entire input array
    around, leading to quadratic performance when converting a run of
    non-representable characters. This is most pronounced when dumping to
    memory.
    
    Output the charref directly instead.
    
    Found with libFuzzer.
    e5107772