Skip to content

Commit 9e99266

Browse files
authored
Fuzzing test 20241122 (#26)
* Fuzzing test Signed-off-by: [email protected] <[email protected]> * removed underflow at tile data size writing Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]>
1 parent a3f40ff commit 9e99266

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/oapv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,9 @@ static int enc_tile(oapve_ctx_t *ctx, oapve_core_t *core, oapve_tile_t *tile)
803803
qp = ctx->qp[Y_C];
804804
}
805805

806-
tile->data_size = 0;
806+
tile->tile_size = 0;
807807
DUMP_SAVE(0);
808-
oapve_vlc_tile_size(&bs, tile->data_size);
808+
oapve_vlc_tile_size(&bs, tile->tile_size);
809809
oapve_set_tile_header(ctx, &tile->th, core->tile_idx, qp);
810810
oapve_vlc_tile_header(ctx, &bs, &tile->th);
811811

@@ -882,11 +882,11 @@ static int enc_tile(oapve_ctx_t *ctx, oapve_core_t *core, oapve_tile_t *tile)
882882
oapv_bs_t bs_th;
883883
bs_th.is_bin_count = 0;
884884
oapv_bsw_init(&bs_th, tile->bs_buf, tile->bs_size, NULL);
885-
tile->data_size = bs_size - OAPV_TILE_SIZE_LEN;
885+
tile->tile_size = bs_size - OAPV_TILE_SIZE_LEN;
886886

887887
DUMP_SAVE(1);
888888
DUMP_LOAD(0);
889-
oapve_vlc_tile_size(&bs_th, tile->data_size);
889+
oapve_vlc_tile_size(&bs_th, tile->tile_size);
890890
oapve_vlc_tile_header(ctx, &bs_th, &tile->th);
891891
DUMP_LOAD(1);
892892
oapv_bsw_deinit(&bs_th);

src/oapv_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ struct oapve_tile {
251251
int y; /* y (row) position in a frame in unit of pixel */
252252
int w; /* tile width in unit of pixel */
253253
int h; /* tile height in unit of pixel */
254-
u32 data_size;
254+
u32 tile_size;
255255
oapve_rc_tile_t rc;
256256
u8 *bs_buf;
257257
s32 bs_size;

src/oapv_vlc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ void oapve_set_tile_header(oapve_ctx_t *ctx, oapv_th_t *th, int tile_idx, int qp
411411
}
412412
}
413413
th->tile_index = tile_idx;
414+
415+
for(int i = 0; i < N_C; i++) {
416+
// this setting is required to prevent underflow at dummy writing tile header due to '-1'.
417+
th->tile_data_size[i] = 1;
418+
}
414419
}
415420

416421
int oapve_vlc_tile_header(oapve_ctx_t *ctx, oapv_bs_t *bs, oapv_th_t *th)

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.9
1+
v0.1.9.2

0 commit comments

Comments
 (0)