diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-08-27 16:46:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-27 16:46:08 -0700 |
commit | 62318cadcefec2d2bfd0d84fdd628be313ff6201 (patch) | |
tree | 6657940e0605fcd4277bbe41dc5e900909bd5d98 | |
parent | 38d674e86f4d5b368e37e20d31a44c2924de6998 (diff) | |
parent | 4473585734b117d93a6f7123b1b40521c9ccae17 (diff) |
Merge pull request #119 from rohitsakala/master
Bugfix for bigendian platforms by casting size_t to unint32_t
-rw-r--r-- | upb/table.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/upb/table.c b/upb/table.c index 61202b0..4239c6f 100644 --- a/upb/table.c +++ b/upb/table.c @@ -270,9 +270,10 @@ static size_t begin(const upb_table *t) { /* A simple "subclass" of upb_table that only adds a hash function for strings. */ static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) { + uint32_t len = (uint32_t) k2.str.len; char *str = upb_malloc(a, k2.str.len + sizeof(uint32_t) + 1); if (str == NULL) return 0; - memcpy(str, &k2.str.len, sizeof(uint32_t)); + memcpy(str, &len, sizeof(uint32_t)); memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len + 1); return (uintptr_t)str; } |