MT#55283 fix bencode buffer alignment

Make sure data is 64-bit aligned. Fixes alignment issues on certain
32-bit archs (armhf).

Change-Id: I66c1fc20e97c62d3d5e266e874812aed74d295ed
(cherry picked from commit 31375ca349)
(cherry picked from commit 7cc36dd28e)
mr12.5.1
Richard Fuchs 4 weeks ago
parent 477a09b143
commit 69a06a1fde

@ -16,13 +16,11 @@
#define BENCODE_HASH_BUCKETS 31 /* prime numbers work best */
#define BENCODE_ALLOC_ALIGN 8
struct __bencode_buffer_piece {
char *tail;
unsigned int left;
struct __bencode_buffer_piece *next;
char buf[0];
char buf[0] __attribute__ ((aligned (BENCODE_ALLOC_ALIGN)));
};
struct __bencode_free_list {
void *ptr;

@ -7,6 +7,8 @@
#include "compat.h"
#define BENCODE_ALLOC_ALIGN 8
struct bencode_buffer;
enum bencode_type;
struct bencode_item;
@ -35,7 +37,7 @@ struct bencode_item {
long long int value; /* when decoding an integer, contains the value; otherwise used internally */
bencode_item_t *parent, *child, *last_child, *sibling;
bencode_buffer_t *buffer;
char __buf[0];
char __buf[0] __attribute__ ((aligned (BENCODE_ALLOC_ALIGN)));
};
struct bencode_buffer {

Loading…
Cancel
Save