Skip to content
  • Michael Weghorn's avatar
    a11y atspi: Don't use char count as byte count · e39ecbf1
    Michael Weghorn authored
    As mentioned in
    
        commit 368f2af6
        Author: Matthias Clasen <mclasen@redhat.com>
        Date:   Mon Oct 2 08:47:53 2023 -0400
    
            a11y: Be safe against non-UTF8 text
    
    , the string insertion APIs take string + length
    and only insert up to `length` bytes of the
    given string.
    
    The AT-SPI "TextChanged" event however
    is using a character count, and `emit_text_changed`
    also gets called with the character count
    along with the string.
    
    However, `g_strndup` used in `emit_text_changed`
    so far takes a byte count, not a character count.
    
    Adapt `emit_text_changed` to just use the
    passed text as is and make it the responsibility
    of the callers to pass only the actually
    inserted/removed string.
    
    Most of the callers in `gtk/a11y/gtkatspitext.c`
    already did that. Adapt two missing ones to do
    likewise.
    
    Fixes: #6151
    e39ecbf1