File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -465,11 +465,17 @@ static otel_process_ctx_result otel_process_ctx_encode_protobuf_payload(char **o
465465 size_t array_value_content_size = protobuf_otel_array_value_content_size (data.thread_ctx_config ->attribute_key_map );
466466 size_t any_value_content_size = protobuf_record_size (array_value_content_size);
467467 size_t kv_content_size = protobuf_string_size (" threadlocal.attribute_key_map" ) + protobuf_record_size (any_value_content_size);
468+ if (kv_content_size > UINT14_MAX ) {
469+ return (otel_process_ctx_result) {.success = false , .error_message = " Encoded size of attribute_key_map exceeds UINT14_MAX limit (" __FILE__ " :" ADD_QUOTES (__LINE__) " )" };
470+ }
468471 thread_ctx_pairs_size += protobuf_record_size (kv_content_size);
469472 }
470473 }
471474
472475 size_t resource_size = pairs_size + resource_attributes_pairs_size;
476+ if (resource_size > UINT14_MAX ) {
477+ return (otel_process_ctx_result) {.success = false , .error_message = " Encoded size of resource attributes exceeds UINT14_MAX limit (" __FILE__ " :" ADD_QUOTES (__LINE__) " )" };
478+ }
473479 size_t total_size = protobuf_record_size (resource_size) + extra_attributes_pairs_size + thread_ctx_pairs_size;
474480
475481 char *encoded = (char *) calloc (total_size, 1 );
You can’t perform that action at this time.
0 commit comments