Skip to content

Conversation

alexandre-huff
Copy link

@alexandre-huff alexandre-huff commented Jan 9, 2025

Hi,

This is a proposal of a fix in the function that converts a byte_buffer to a uint64_t value.

Currently, when the size of a byte_buffer is greater than 1, the code mistakenly converts the bytes into an incorrect uint64_t value.

The static_cast<uint64_t>((nbytes - 1 - i) * 8U) erroneously inverts the order of the bits in the resulting value, so that functions void octet_string_helper::to_octet_string(srsran::byte_buffer& buf, uint64_t number) and uint64_t octet_string_helper::to_uint(const byte_buffer& buf) are not equivalent.

Signed-off-by: Alexandre Huff <alexandrehuff@utfpr.edu.br>
@ismagom ismagom requested a review from frankist January 10, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant