@@ -1897,9 +1897,7 @@ display_gl_get_property(void *state, int property, void *val, size_t *len)
1897
1897
1898
1898
switch (property) {
1899
1899
case DISPLAY_PROPERTY_CODECS: {
1900
- if (sizeof gl_supp_codecs > *len) {
1901
- return false ;
1902
- }
1900
+ UG_ASSERT (*len >= sizeof gl_supp_codecs);
1903
1901
auto filter_codecs = [s](codec_t c) {
1904
1902
if (get_bits_per_component (c) > DEPTH8 &&
1905
1903
commandline_params.find (
@@ -1925,23 +1923,18 @@ display_gl_get_property(void *state, int property, void *val, size_t *len)
1925
1923
return true ;
1926
1924
}
1927
1925
case DISPLAY_PROPERTY_RGB_SHIFT:
1928
- if (sizeof (rgb_shift) > *len) {
1929
- return false ;
1930
- }
1926
+ UG_ASSERT (*len >= sizeof rgb_shift);
1931
1927
memcpy (val, rgb_shift, sizeof (rgb_shift));
1932
1928
*len = sizeof (rgb_shift);
1933
1929
return true ;
1934
1930
case DISPLAY_PROPERTY_BUF_PITCH:
1931
+ UG_ASSERT (*len >= sizeof (int ));
1935
1932
*(int *) val = PITCH_DEFAULT;
1936
1933
*len = sizeof (int );
1937
1934
return true ;
1938
1935
case DISPLAY_PROPERTY_SUPPORTED_IL_MODES:
1939
- if (sizeof (supported_il_modes) <= *len) {
1940
- memcpy (val, supported_il_modes,
1941
- sizeof (supported_il_modes));
1942
- } else {
1943
- return false ;
1944
- }
1936
+ UG_ASSERT (*len >= sizeof supported_il_modes);
1937
+ memcpy (val, supported_il_modes, sizeof (supported_il_modes));
1945
1938
*len = sizeof (supported_il_modes);
1946
1939
return true ;
1947
1940
default :
0 commit comments