Browse Source

Cherry-pick upstream commit "Fix sizeof(http_parser) assert"

Christoph Biedl 3 years ago
parent
commit
4e4ce7d918

+ 29 - 0
debian/patches/cherry-pick.v2.9.4-9-g4f15b7d.fix-sizeof-http-parser-assert.patch

@@ -0,0 +1,29 @@
+Subject: Fix sizeof(http_parser) assert
+Origin: v2.9.4-9-g4f15b7d <https://github.com/joyent/http-parser/commit/v2.9.4-9-g4f15b7d>
+Upstream-Author: Ben Noordhuis <info@bnoordhuis.nl>
+Date: Fri Jul 10 11:55:11 2020 +0200
+
+    The result should be 32 on both 32 bits and 64 bits x86 because of
+    struct padding.
+
+    Fixes: https://github.com/nodejs/http-parser/issues/507
+    PR-URL: https://github.com/nodejs/http-parser/pull/510
+    Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
+
+--- a/test.c
++++ b/test.c
+@@ -4221,7 +4221,13 @@
+   printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version);
+ 
+   printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
+-  assert(sizeof(http_parser) == 4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *));
++
++#if defined(__i386__) || defined(__x86_64__)
++  /* Should be 32 on both 32 bits and 64 bits x86 because of struct padding,
++   * see https://github.com/nodejs/http-parser/issues/507.
++   */
++  assert(sizeof(http_parser) == 32);
++#endif
+ 
+   //// API
+   test_preserve_data();

+ 3 - 0
debian/patches/series

@@ -1,2 +1,5 @@
+# cherry-picked commits. Keep in upstream's chronological order
+cherry-pick.v2.9.4-9-g4f15b7d.fix-sizeof-http-parser-assert.patch
+
 # Debian-specific
 debian.improve-installation.patch