Skip to content
Snippets Groups Projects
  • Jean Chalard's avatar
    c2e9c511
    Fix Binary dict tests · c2e9c511
    Jean Chalard authored
    There are two problems here. The first one is the tests would send
    an invalid unicode character. Although we could want dicttool to
    handle this more gracefully, it's fine for now.
    
    The second problem is much more serious. If a node has more than
    128 children, then the java code will crash trying to read the
    dictionary back because of a bug that this change fixes. In
    theory, it's possible that happens when we try to load the user
    history dictionary back from the disk - native code is not affected
    so there is no other point that may cause a problem.
    In the practice, that means you'd need to have 129 words with a
    common prefix (including empty string) but all different after
    this. It's almost impossible with Google Keyboard since there are
    only so many keys on the keyboard that you can make a word out
    of, and then again you'd have to do it repeatedly until it
    actually enters the user history dictionary, wait for it to get
    saved on the disk.
    The bad news is, if you manage to get this far, the keyboard will
    crash every time and won't be able to get up until you clear
    data for the package.
    The good news is, the dictionary itself is not corrupted and only
    the reading code is wrong. So updating to a newer version would
    actually even recover from this situation.
    
    All in all, considering how almost-impossible this is to trigger,
    I don't think even a single user actually did hit this bug.
    
    Bug: 8583091
    Change-Id: Iabb2a7f47cbd9ed3193d2a3487318d280753e071
    c2e9c511
    History
    Fix Binary dict tests
    Jean Chalard authored
    There are two problems here. The first one is the tests would send
    an invalid unicode character. Although we could want dicttool to
    handle this more gracefully, it's fine for now.
    
    The second problem is much more serious. If a node has more than
    128 children, then the java code will crash trying to read the
    dictionary back because of a bug that this change fixes. In
    theory, it's possible that happens when we try to load the user
    history dictionary back from the disk - native code is not affected
    so there is no other point that may cause a problem.
    In the practice, that means you'd need to have 129 words with a
    common prefix (including empty string) but all different after
    this. It's almost impossible with Google Keyboard since there are
    only so many keys on the keyboard that you can make a word out
    of, and then again you'd have to do it repeatedly until it
    actually enters the user history dictionary, wait for it to get
    saved on the disk.
    The bad news is, if you manage to get this far, the keyboard will
    crash every time and won't be able to get up until you clear
    data for the package.
    The good news is, the dictionary itself is not corrupted and only
    the reading code is wrong. So updating to a newer version would
    actually even recover from this situation.
    
    All in all, considering how almost-impossible this is to trigger,
    I don't think even a single user actually did hit this bug.
    
    Bug: 8583091
    Change-Id: Iabb2a7f47cbd9ed3193d2a3487318d280753e071