• BatmanAoD@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    18 hours ago

    Okay, yeah, I was indeed reading your original reply as a criticism of one of the people involved (presumably the security researcher), rather than as a criticism of the post title. Sorry for misunderstanding.

    Apparently GCC does indeed do tail-call optimization at -O2: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-foptimize-sibling-calls

    But in that case, I’m not sure why the solution to the denial of service vulnerability isn’t just “compile with -foptimize-sibling-calls.”

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      1
      ·
      16 hours ago

      I mean, “criticism” is a little extreme even, because it’s a humour post, and I was just riffing back.

      Apparently GCC does indeed do tail-call optimization at -O2

      Hmm, I wonder why it’s considered O2 heavy. The concept of turning tail recursion into loops is simple.

      But in that case, I’m not sure why the solution to the denial of service vulnerability isn’t just “compile with -foptimize-sibling-calls.”

      Probably because some of the recursion involved is non-tail. Actually, it looks like GCC might still be able to cases of corecursion where the functions are “stack compatibale”, but presumably most functions aren’t, and who knows what little knots they tied the parsing functions in this XML library into.