Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jun 5, 2024

The use of Span is problematic, because it lacks methods such as rbegin, leading to compile failures when used:

error: no member named 'rbegin' in 'Span<const unsigned char>'

One could fix Span, but it seems better to use std::span, given that Span will be removed anyway in the long term.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 5, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK dergoegge

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@dergoegge
Copy link
Member

I'm out of the loop on converting Span to std::span, why is ok to do this here but not everywhere?

@maflcko
Copy link
Member Author

maflcko commented Jun 10, 2024

I'm out of the loop on converting Span to std::span, why is ok to do this here but not everywhere?

Good question!

It is quite some work to do it everywhere (I am working on it), because Span and std::span differ in their interface. (One is lacking methods of the other, and vice-versa).

However, as long as the replacement compiles, it should be safe.

Moreover, FuzzBufferType is a distinct type, mainly used to denote the type of a byte-view, which will be passed to FuzzedDataProvider, so the switch can be done independently here, without affecting non-fuzz code.

Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK fabc9b0

@maflcko maflcko requested a review from fanquake June 12, 2024 09:56
@fanquake
Copy link
Member

I think this is ok to do, but you'll need adjust the bitset code instroduced in #30160:

test/fuzz/bitset.cpp:284:23: error: no matching function for call to 'ReadByte'
    unsigned typdat = ReadByte(buffer) % 8;
                      ^~~~~~~~
test/fuzz/bitset.cpp:16:9: note: candidate function not viable: no known conversion from 'FuzzBufferType' (aka 'span<const unsigned char>') to 'Span<const uint8_t> &' (aka 'Span<const unsigned char> &') for 1st argument
uint8_t ReadByte(Span<const uint8_t>& buffer)
        ^
1 error generated.

@maflcko
Copy link
Member Author

maflcko commented Jun 12, 2024

Thanks for spotting the silent merge conflict. Rebased.

Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK faa41e2

@fanquake fanquake merged commit a7bc9b7 into bitcoin:master Jun 12, 2024
@maflcko maflcko deleted the 2406-fuzz-span branch June 12, 2024 17:17
@bitcoin bitcoin locked and limited conversation to collaborators Jun 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants