Branch: Tag:

2014-05-04

2014-05-04 22:13:10 by Martin Nilsson <nilsson@opera.com>

Fail predicably with a fatal decoding_error on any low level syntax errors.

1021:    sscanf(handshake_buffer, "%*c%3c", len);    if (sizeof(handshake_buffer) < (len + 4))    break; +  mixed exception = catch {    err = handle_handshake(handshake_buffer[0],    handshake_buffer[4..len + 3],    handshake_buffer[.. len + 3]); -  +  }; +  if( exception ) +  { +  if( objectp(exception) && ([object]exception)->ADT_struct ) +  { +  Error.Generic e = [object(Error.Generic)]exception; +  send_packet(Alert(ALERT_fatal, ALERT_decode_error, +  e->message())); +  return -1; +  } +  throw(exception); +  }    handshake_buffer = handshake_buffer[len + 4..];    if (err < 0)    return err;
1064:    "Heart beat mode not enabled.\n"));    break;    } +  +  mixed exception = catch {    handle_heartbeat(packet->fragment); -  +  }; +  if( exception ) +  { +  if( objectp(exception) && ([object]exception)->ADT_struct ) +  { +  Error.Generic e = [object(Error.Generic)]exception; +  send_packet(Alert(ALERT_fatal, ALERT_decode_error, +  e->message())); +  return -1;    } -  +  throw(exception); +  } +  +  }    break;    default:    if (!handshake_finished)