cherry-pick.v2.9.4-9-g4f15b7d.fix-sizeof-http-parser-assert.patch 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. Subject: Fix sizeof(http_parser) assert
  2. Origin: v2.9.4-9-g4f15b7d <https://github.com/joyent/http-parser/commit/4f15b7d>
  3. Upstream-Author: Ben Noordhuis <info@bnoordhuis.nl>
  4. Date: Fri Jul 10 11:55:11 2020 +0200
  5. Bug: https://github.com/nodejs/http-parser/issues/526
  6. Comment: Changed again to make build pass on i386, see bug URL in previous line
  7. The result should be 32 on both 32 bits and 64 bits x86 because of
  8. struct padding.
  9. Fixes: https://github.com/nodejs/http-parser/issues/507
  10. PR-URL: https://github.com/nodejs/http-parser/pull/510
  11. Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
  12. --- a/test.c
  13. +++ b/test.c
  14. @@ -4343,7 +4343,13 @@
  15. printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version);
  16. printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
  17. +
  18. +#if (defined(__i386__) || defined(__x86_64__)) && !defined (__ILP32__)
  19. + /* Should be 32 on both 32 bits and 64 bits x86 because of struct padding,
  20. + * see https://github.com/nodejs/http-parser/issues/507.
  21. + */
  22. assert(sizeof(http_parser) == 4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *));
  23. +#endif
  24. //// API
  25. test_preserve_data();