@@ -152,7 +152,8 @@ Word send_local_response(Word response_code, Word response_code_details_ptr,
152
152
if (!details || !body || !additional_response_header_pairs) {
153
153
return WasmResult::InvalidMemoryAccess;
154
154
}
155
- auto additional_headers = PairsUtil::toPairs (additional_response_header_pairs.value ());
155
+ auto additional_headers = PairsUtil::toPairs (additional_response_header_pairs.value (),
156
+ context->wasmVm ()->isWasmByteOrder ());
156
157
context->sendLocalResponse (response_code, body.value (), std::move (additional_headers),
157
158
grpc_status, details.value ());
158
159
context->wasm ()->stopNextIteration (true );
@@ -399,7 +400,7 @@ Word get_header_map_pairs(Word type, Word ptr_ptr, Word size_ptr) {
399
400
if (buffer == nullptr ) {
400
401
return WasmResult::InvalidMemoryAccess;
401
402
}
402
- if (!PairsUtil::marshalPairs (pairs, buffer, size)) {
403
+ if (!PairsUtil::marshalPairs (pairs, buffer, size, context-> wasmVm ()-> isWasmByteOrder () )) {
403
404
return WasmResult::InvalidMemoryAccess;
404
405
}
405
406
if (!context->wasmVm ()->setWord (ptr_ptr, Word (ptr))) {
@@ -420,8 +421,9 @@ Word set_header_map_pairs(Word type, Word ptr, Word size) {
420
421
if (!data) {
421
422
return WasmResult::InvalidMemoryAccess;
422
423
}
423
- return context->setHeaderMapPairs (static_cast <WasmHeaderMapType>(type.u64_ ),
424
- PairsUtil::toPairs (data.value ()));
424
+ return context->setHeaderMapPairs (
425
+ static_cast <WasmHeaderMapType>(type.u64_ ),
426
+ PairsUtil::toPairs (data.value (), context->wasmVm ()->isWasmByteOrder ()));
425
427
}
426
428
427
429
Word get_header_map_size (Word type, Word result_ptr) {
@@ -519,8 +521,8 @@ Word http_call(Word uri_ptr, Word uri_size, Word header_pairs_ptr, Word header_p
519
521
if (!uri || !body || !header_pairs || !trailer_pairs) {
520
522
return WasmResult::InvalidMemoryAccess;
521
523
}
522
- auto headers = PairsUtil::toPairs (header_pairs.value ());
523
- auto trailers = PairsUtil::toPairs (trailer_pairs.value ());
524
+ auto headers = PairsUtil::toPairs (header_pairs.value (), context-> wasmVm ()-> isWasmByteOrder () );
525
+ auto trailers = PairsUtil::toPairs (trailer_pairs.value (), context-> wasmVm ()-> isWasmByteOrder () );
524
526
uint32_t token = 0 ;
525
527
// NB: try to write the token to verify the memory before starting the async
526
528
// operation.
@@ -589,7 +591,8 @@ Word grpc_call(Word service_ptr, Word service_size, Word service_name_ptr, Word
589
591
return WasmResult::InvalidMemoryAccess;
590
592
}
591
593
uint32_t token = 0 ;
592
- auto initial_metadata = PairsUtil::toPairs (initial_metadata_pairs.value ());
594
+ auto initial_metadata =
595
+ PairsUtil::toPairs (initial_metadata_pairs.value (), context->wasmVm ()->isWasmByteOrder ());
593
596
auto result = context->grpcCall (service.value (), service_name.value (), method_name.value (),
594
597
initial_metadata, request.value (),
595
598
std::chrono::milliseconds (timeout_milliseconds), &token);
@@ -615,7 +618,8 @@ Word grpc_stream(Word service_ptr, Word service_size, Word service_name_ptr, Wor
615
618
return WasmResult::InvalidMemoryAccess;
616
619
}
617
620
uint32_t token = 0 ;
618
- auto initial_metadata = PairsUtil::toPairs (initial_metadata_pairs.value ());
621
+ auto initial_metadata =
622
+ PairsUtil::toPairs (initial_metadata_pairs.value (), context->wasmVm ()->isWasmByteOrder ());
619
623
auto result = context->grpcStream (service.value (), service_name.value (), method_name.value (),
620
624
initial_metadata, &token);
621
625
if (result != WasmResult::Ok) {
@@ -693,8 +697,9 @@ Word writevImpl(Word fd, Word iovs, Word iovs_len, Word *nwritten_ptr) {
693
697
}
694
698
const auto *iovec = reinterpret_cast <const uint32_t *>(memslice.value ().data ());
695
699
if (iovec [1 ] != 0U /* buf_len */ ) {
696
- memslice = context->wasmVm ()->getMemory (wasmtoh (iovec [0 ]) /* buf */ ,
697
- wasmtoh (iovec [1 ]) /* buf_len */ );
700
+ memslice = context->wasmVm ()->getMemory (
701
+ wasmtoh (iovec [0 ], context->wasmVm ()->isWasmByteOrder ()) /* buf */ ,
702
+ wasmtoh (iovec [1 ], context->wasmVm ()->isWasmByteOrder ()) /* buf_len */ );
698
703
if (!memslice) {
699
704
return 21 ; // __WASI_EFAULT
700
705
}
0 commit comments