mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
fixes character processing bug when using LLVM libc++
This commit is contained in:
@@ -63,26 +63,23 @@ public:
|
||||
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (input.good()) {
|
||||
c = input.get();
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
// istream read error? throw?
|
||||
throw processor::exception("istream read error",processor::error::FATAL_ERROR);
|
||||
}
|
||||
if (input.good()) {
|
||||
// process c
|
||||
c = input.get();
|
||||
|
||||
if (input.fail()) {
|
||||
throw processor::exception("istream read error",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
|
||||
if (m_masking_index >= 0) {
|
||||
c = c ^ m_masking_key[(m_masking_index++)%4];
|
||||
}
|
||||
|
||||
// add c to payload
|
||||
m_payload.push_back(c);
|
||||
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
// istream read error? throw?
|
||||
throw processor::exception("istream read error",processor::error::FATAL_ERROR);
|
||||
throw processor::exception("istream read error",processor::error::FATAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,19 +65,15 @@ uint64_t data::process_payload(std::istream& input,uint64_t size) {
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (input.good()) {
|
||||
c = input.get();
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
// istream read error? throw?
|
||||
throw processor::exception("istream read error",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
if (input.good()) {
|
||||
|
||||
if (input.fail()) {
|
||||
throw processor::exception("istream read error",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
process_character(c);
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
// istream read error? throw?
|
||||
throw processor::exception("istream read error",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
@@ -117,6 +113,7 @@ void data::complete() {
|
||||
throw processor::exception("Invalid UTF8 data",processor::error::PAYLOAD_VIOLATION);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void data::validate_payload() {
|
||||
|
||||
@@ -76,6 +76,7 @@ void hybi_header::consume(std::istream& input) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//std::cout << "header so far: " << to_hex(std::string(m_header,MAX_HEADER_LENGTH)) << std::endl;
|
||||
}
|
||||
uint64_t hybi_header::get_bytes_needed() const {
|
||||
return m_bytes_needed;
|
||||
|
||||
Reference in New Issue
Block a user