Skip to content

Raise error when data is not enough in FDP buffer for consuming a new value #36

@ligurio

Description

@ligurio

luzer has a FuzzedDataProvider, FDP should be initialized by a buffer with finite length. It means that FDP can provide a limited number of values using consume_ methods. When data in FDP is over methods returns constant default values:

> fdp = luzer.FuzzedDataProvider("")
---                                 
...
      
> fdp:consume_integer(1, 2) -- return a min value in range
---
- 1
...

> fdp:consume_string(1) -- return a nil
---
- 
...
tarantool> fdp:consume_number(1, 2) -- return min value in range
---
- 1
...

tarantool> fdp:consume_boolean(1, 2) -- return false
---
- false
...

It is proposed to raise an error in such cases.

luzer's FDP is based on libFuzzer's FDP, and it is expected behaviour there, see 1:

Footnotes

  1. https://github.com/llvm/llvm-project/blob/fcaefc2c19ebe037df7115f02abf23f94c07e8cc/compiler-rt/include/fuzzer/FuzzedDataProvider.h#L192-L194

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions