Apparently sparc64 is way more strict about uint16_t access alignment than I had thought: it gave bus errors when messing with var-cell headers. Maybe this patch will fix bug 862.

svn:r17262
This commit is contained in:
Nick Mathewson 2008-11-12 14:41:44 +00:00
parent a790a13705
commit c36ddcbabf
3 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,8 @@ Changes in version 0.2.1.8-alpha - 2008-??-??
bug 859.
- Made Tor a little less aggressive about deleting expired certificates.
Partial fix for bug 854.
- Stop doing unaligned memory access that generated bus errors on
sparc64. Fix for bug 862.
o Minor features (controller):
- Return circuit purposes in response to GETINFO circuit-status. Fixes

View File

@ -1010,7 +1010,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto)
return 0;
peek_from_buf(hdr, sizeof(hdr), buf);
command = *(uint8_t*)(hdr+2);
command = get_uint8(hdr+2);
if (!(CELL_COMMAND_IS_VAR_LENGTH(command)))
return 0;
@ -1019,7 +1019,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto)
return 1;
result = var_cell_new(length);
result->command = command;
result->circ_id = ntohs(*(uint16_t*)hdr);
result->circ_id = ntohs(get_uint16(hdr));
buf_remove_from_front(buf, VAR_CELL_HEADER_SIZE);
peek_from_buf(result->payload, length, buf);

View File

@ -157,8 +157,8 @@ cell_unpack(cell_t *dest, const char *src)
void
var_cell_pack_header(const var_cell_t *cell, char *hdr_out)
{
*(uint16_t*)(hdr_out) = htons(cell->circ_id);
*(uint8_t*)(hdr_out+2) = cell->command;
set_uint16(hdr_out, htons(cell->circ_id));
set_uint8(hdr_out+2, cell->command);
set_uint16(hdr_out+3, htons(cell->payload_len));
}