Skip to content
  • Jehan's avatar
    app: fix a crash when converting to higher precision. · aab73ae3
    Jehan authored
    gimp_display_shell_render() writes to a GeglBuffer backed by allocated memory
    (shell->profile_data). Unfortunately while converting prevision in
    gimp_image_convert_precision(), we change the "precision" property (hence the
    source format) first, hence end up trying to write data in a too small buffer.
    This crash was hard to find as it was not showing up on my machine (though it
    did produce rendering artifacts!), unless I built both GIMP and babl with
    `b_sanitize=address`.
    
    Note that an alternate fix was to make sure that the profile_data buffer is big
    enough (by calling gimp_display_shell_profile_update() before rendering), but
    anyway the image is in an inconsistent state while conversion is in progress:
    whereas the `src_format` is the new one, the `src_profile` is still the old one
    (and cannot be changed before we finish converting).
    
    Moreover the render happen regularly on progress signals, once after each
    converted drawable. So each of these renderin...
    aab73ae3