Skip to content

Commit

Permalink
return error when PCM bits parameter exceeds pixel depth (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Feb 23, 2021
1 parent 4c0fe2c commit a3f1c6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libde265/de265.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ LIBDE265_API const char* de265_get_error_text(de265_error err)
return "SPS header missing, cannot decode SEI";
case DE265_WARNING_COLLOCATED_MOTION_VECTOR_OUTSIDE_IMAGE_AREA:
return "collocated motion-vector is outside image area";
case DE265_WARNING_PCM_BITDEPTH_TOO_LARGE:
return "PCM bit-depth too large";

default: return "unknown error";
}
Expand Down
3 changes: 2 additions & 1 deletion libde265/de265.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ typedef enum {
DE265_NON_EXISTING_LT_REFERENCE_CANDIDATE_IN_SLICE_HEADER=1023,
DE265_WARNING_CANNOT_APPLY_SAO_OUT_OF_MEMORY=1024,
DE265_WARNING_SPS_MISSING_CANNOT_DECODE_SEI=1025,
DE265_WARNING_COLLOCATED_MOTION_VECTOR_OUTSIDE_IMAGE_AREA=1026
DE265_WARNING_COLLOCATED_MOTION_VECTOR_OUTSIDE_IMAGE_AREA=1026,
DE265_WARNING_PCM_BITDEPTH_TOO_LARGE=1027
} de265_error;

LIBDE265_API const char* de265_get_error_text(de265_error err);
Expand Down
10 changes: 10 additions & 0 deletions libde265/sps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ de265_error seq_parameter_set::read(error_queue* errqueue, bitreader* br)
READ_VLC_OFFSET(log2_min_pcm_luma_coding_block_size, uvlc, 3);
READ_VLC(log2_diff_max_min_pcm_luma_coding_block_size, uvlc);
pcm_loop_filter_disable_flag = get_bits(br,1);

if (pcm_sample_bit_depth_luma > bit_depth_luma) {
errqueue->add_warning(DE265_WARNING_PCM_BITDEPTH_TOO_LARGE, false);
return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE;
}

if (pcm_sample_bit_depth_chroma > bit_depth_chroma) {
errqueue->add_warning(DE265_WARNING_PCM_BITDEPTH_TOO_LARGE, false);
return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE;
}
}
else {
pcm_sample_bit_depth_luma = 0;
Expand Down

0 comments on commit a3f1c6a

Please sign in to comment.