Merge branch 'X11Libre:master' into master

This commit is contained in:
Xgui4 Studio 2025-06-25 00:14:55 -04:00 committed by GitHub
commit b4b273018d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 10 deletions

View File

@ -3,7 +3,7 @@ project('xserver', 'c',
'buildtype=debugoptimized',
'c_std=gnu99',
],
version: '25.0.0.0',
version: '25.0.0.1',
meson_version: '>= 0.58.0',
)
release_date = '2025-06-21'

View File

@ -119,6 +119,12 @@ RRDeleteProviderProperty(RRProviderPtr provider, Atom property)
}
}
/* shortcut for cleaning up property when failed to add */
static inline void cleanupProperty(RRPropertyPtr prop, Bool added) {
if ((prop != NULL) && added)
RRDestroyProviderProperty(prop);
}
int
RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
int format, int mode, unsigned long len,
@ -166,13 +172,14 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
if (mode == PropModeReplace || len > 0) {
void *new_data = NULL, *old_data = NULL;
if (total_len > MAXINT / size_in_bytes)
if (total_len > MAXINT / size_in_bytes) {
cleanupProperty(prop, add);
return BadValue;
}
total_size = total_len * size_in_bytes;
new_value.data = calloc(1, total_size);
if (!new_value.data && total_size) {
if (add)
RRDestroyProviderProperty(prop);
cleanupProperty(prop, add);
return BadAlloc;
}
new_value.size = len;
@ -204,8 +211,7 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
if (pending && pScrPriv->rrProviderSetProperty &&
!pScrPriv->rrProviderSetProperty(provider->pScreen, provider,
prop->propertyName, &new_value)) {
if (add)
RRDestroyProviderProperty(prop);
cleanupProperty(prop, add);
free(new_value.data);
return BadValue;
}
@ -292,8 +298,7 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
* ranges must have even number of values
*/
if (range && (num_values & 1)) {
if (add)
RRDestroyProviderProperty(prop);
cleanupProperty(prop, add);
return BadMatch;
}
@ -301,8 +306,7 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
if (num_values) {
new_values = calloc(num_values, sizeof(INT32));
if (!new_values) {
if (add)
RRDestroyProviderProperty(prop);
cleanupProperty(prop, add);
return BadAlloc;
}
memcpy(new_values, values, num_values * sizeof(INT32));