@@ -47,10 +47,18 @@ int LLVMFuzzerTestOneInput(
4747 const uint8_t *data,
4848 size_t size )
4949{
50+ uint8_t buffer[ 512 ];
51+ char string[ 64 ];
52+
5053 libbfio_handle_t *file_io_handle = NULL ;
51- libvsbsdl_partition_t *partition = NULL ;
52- libvsbsdl_volume_t *volume = NULL ;
54+ libvsbsdl_partition_t *partition = NULL ;
55+ libvsbsdl_volume_t *volume = NULL ;
56+ off64_t partition_offset = 0 ;
57+ off64_t volume_offset = 0 ;
58+ size64_t partition_size = 0 ;
59+ uint16_t value_16bit = 0 ;
5360 int number_of_partitions = 0 ;
61+ int read_iterator = 0 ;
5462
5563 if ( libbfio_memory_range_initialize (
5664 &file_io_handle,
@@ -93,12 +101,62 @@ int LLVMFuzzerTestOneInput(
93101 volume,
94102 0 ,
95103 &partition,
96- NULL ) == 1 )
104+ NULL ) != 1 )
105+ {
106+ goto on_error_libvsbsdl_volume;
107+ }
108+ if ( libvsbsdl_partition_get_entry_index (
109+ partition,
110+ &value_16bit,
111+ NULL ) != 1 )
112+ {
113+ goto on_error_libvsbsdl_partition;
114+ }
115+ if ( libvsbsdl_partition_get_name_string (
116+ partition,
117+ string,
118+ 64 ,
119+ NULL ) != 1 )
120+ {
121+ goto on_error_libvsbsdl_partition;
122+ }
123+ if ( libvsbsdl_partition_get_volume_offset (
124+ partition,
125+ &volume_offset,
126+ NULL ) != 1 )
127+ {
128+ goto on_error_libvsbsdl_partition;
129+ }
130+ if ( libvsbsdl_partition_get_size (
131+ partition,
132+ &partition_size,
133+ NULL ) != 1 )
134+ {
135+ goto on_error_libvsbsdl_partition;
136+ }
137+ for ( read_iterator = 0 ;
138+ read_iterator < 128 ;
139+ read_iterator++ )
97140 {
98- libvsbsdl_partition_free (
99- &partition,
100- NULL );
141+ if ( partition_offset >= partition_size )
142+ {
143+ break ;
144+ }
145+ if ( libvsbsdl_partition_read_buffer_at_offset (
146+ partition,
147+ buffer,
148+ 497 ,
149+ partition_offset,
150+ NULL ) == -1 )
151+ {
152+ goto on_error_libvsbsdl_partition;
153+ }
154+ partition_offset += 497 ;
101155 }
156+ on_error_libvsbsdl_partition:
157+ libvsbsdl_partition_free (
158+ &partition,
159+ NULL );
102160 }
103161 libvsbsdl_volume_close (
104162 volume,
0 commit comments