##// END OF EJS Templates
Copy index before parsing to enforce alignment with inline data present....
Thomas Arendsen Hein -
r7169:6d28a399 default
parent child Browse files
Show More
@@ -292,23 +292,25 b' static int _parse_index_ng (const char *'
292 int comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2;
292 int comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2;
293 const char *c_node_id;
293 const char *c_node_id;
294 const char *end = data + size;
294 const char *end = data + size;
295 char decode[64]; /* to enforce alignment with inline data */
295
296
296 while (data < end) {
297 while (data < end) {
297 offset_flags = ntohl(*((uint32_t *) (data + 4)));
298 memcpy(decode, data, 64);
299 offset_flags = ntohl(*((uint32_t *) (decode + 4)));
298 if (n == 0) /* mask out version number for the first entry */
300 if (n == 0) /* mask out version number for the first entry */
299 offset_flags &= 0xFFFF;
301 offset_flags &= 0xFFFF;
300 else {
302 else {
301 uint32_t offset_high = ntohl(*((uint32_t *) data));
303 uint32_t offset_high = ntohl(*((uint32_t *) decode));
302 offset_flags |= ((uint64_t) offset_high) << 32;
304 offset_flags |= ((uint64_t) offset_high) << 32;
303 }
305 }
304
306
305 comp_len = ntohl(*((uint32_t *) (data + 8)));
307 comp_len = ntohl(*((uint32_t *) (decode + 8)));
306 uncomp_len = ntohl(*((uint32_t *) (data + 12)));
308 uncomp_len = ntohl(*((uint32_t *) (decode + 12)));
307 base_rev = ntohl(*((uint32_t *) (data + 16)));
309 base_rev = ntohl(*((uint32_t *) (decode + 16)));
308 link_rev = ntohl(*((uint32_t *) (data + 20)));
310 link_rev = ntohl(*((uint32_t *) (decode + 20)));
309 parent_1 = ntohl(*((uint32_t *) (data + 24)));
311 parent_1 = ntohl(*((uint32_t *) (decode + 24)));
310 parent_2 = ntohl(*((uint32_t *) (data + 28)));
312 parent_2 = ntohl(*((uint32_t *) (decode + 28)));
311 c_node_id = data + 32;
313 c_node_id = decode + 32;
312
314
313 entry = _build_idx_entry(nodemap, n, offset_flags,
315 entry = _build_idx_entry(nodemap, n, offset_flags,
314 comp_len, uncomp_len, base_rev,
316 comp_len, uncomp_len, base_rev,
General Comments 0
You need to be logged in to leave comments. Login now