Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: Check optipng is there before we use it #321

Merged
merged 1 commit into from Jun 21, 2021

Commits on Jun 21, 2021

  1. compose: Check optipng is there before we use it

    There are two places we can beef up the checks for optipng
    
      - When enabling its usage, make sure we found it first, and refuse to
        enable if we didn't.
      - In case `asc_compose_set_optipng_binary (NULL)` was called, check
        before spawning that we have *a* path. It's a programmer error to
        call `g_spawn_sync ()` with `NULL` in `argv[0]`, and the program
        will crash in that case. Also treat `NULL` as disabling optipng when
        passed to `asc_compose_set_optipng_binary`.
    
    In case the binary is removed mid-run or an invalid binary is passed to
    `asc_compose_set_optipng_binary`, the `g_spawn_sync` call itself will
    fail and we'll report a proper GError. This is the best way to handle
    it, as we avoid TOCTTOU races that way.
    Iain Lane committed Jun 21, 2021