]> granicus.if.org Git - curl/commit
doh: fix undefined behaviour and open up for gcc and clang optimization
authorPaul Dreik <github@pauldreik.se>
Fri, 13 Sep 2019 18:06:21 +0000 (20:06 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 15 Sep 2019 21:27:45 +0000 (23:27 +0200)
commitdda418266c99ceab368d723facb52069cbb9c8d5
tree51d6bcfe1b2edc90edbe59dbfce5548368b26ac8
parentb7666027296a4f89a8ce6b22af335e8aee7a7782
doh: fix undefined behaviour and open up for gcc and clang optimization

The undefined behaviour is annoying when running fuzzing with
sanitizers. The codegen is the same, but the meaning is now not up for
dispute. See https://cppinsights.io/s/516a2ff4

By incrementing the pointer first, both gcc and clang recognize this as
a bswap and optimizes it to a single instruction.  See
https://godbolt.org/z/994Zpx

Closes #4350
lib/doh.c