Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1971: Safely multiply values to be used for memory allocation. #531

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

aleitner
Copy link
Contributor

CodeQL has flagged a potential integer overflow so I used guac_mem_ckd_mul_or_die() to safely multiple the values.

@jmuehlner jmuehlner merged commit 2aabe28 into apache:main Jul 19, 2024
1 check passed
@necouchman
Copy link
Contributor

@aleitner and @jmuehlner Should this get fixed in the patch branch, and then applied to the changes in main, as well?

@jmuehlner
Copy link
Contributor

@necouchman this fix is related to the FreeRDP 3 code, which isn't in patch.

@necouchman
Copy link
Contributor

Okay. I asked because the call to _aligned_malloc is in there in the previous version:

/* Allocate data for image */
unsigned char* data = _aligned_malloc(pointer->width * pointer->height * 4, 16);

and I think the changes made for FreeRDP3 commits just wrap that call based on whether it should be winpr_aligned_malloc or _aligned_malloc:

#ifdef HAVE_WINPR_ALIGNED
#define GUAC_ALIGNED_FREE winpr_aligned_free
#define GUAC_ALIGNED_MALLOC winpr_aligned_malloc
#else
#define GUAC_ALIGNED_FREE _aligned_free
#define GUAC_ALIGNED_MALLOC _aligned_malloc
#endif

I wasn't sure if it only affects one case and not the previous one...

@jmuehlner
Copy link
Contributor

Ah, good call. Yeah this should be fixed in patch as well, for the old call.

@mike-jumper
Copy link
Contributor

FWIW, I've looked through the FreeRDP code surrounding this, and the values in question are strongly limited to 32x32 or 96x96 (_update_read_pointer_color()) or 384x384 (_update_read_pointer_large()).

It's probably still worth fixing on patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants