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

AudioEffectPitchShift: Prevent negative size memset (GCC warning) #88509

Merged

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented Feb 18, 2024

Fixes a warning when using it for memset (from #88504):

servers/audio/effects/audio_effect_pitch_shift.cpp: In member function 'PitchShift.constprop':
servers/audio/effects/audio_effect_pitch_shift.cpp:163:31: warning: 'memset' specified bound between 18446744065119617024 and 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  163 |                         memset(gSynMagn, 0, fftFrameSize*sizeof(float));
      |                               ^
servers/audio/effects/audio_effect_pitch_shift.cpp:164:31: warning: 'memset' specified bound between 18446744065119617024 and 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  164 |                         memset(gSynFreq, 0, fftFrameSize*sizeof(float));
      |                               ^

This is "thirdparty" code part of our own Godot code, so I just worked around the problem where it appears, instead of refactoring the whole function to properly make use of unsigned types throughout when signed results aren't needed.

@akien-mga akien-mga added enhancement topic:audio cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Feb 18, 2024
@akien-mga akien-mga added this to the 4.3 milestone Feb 18, 2024
@akien-mga akien-mga requested a review from a team as a code owner February 18, 2024 17:55
@akien-mga akien-mga force-pushed the pitchshift-unsigned-fft-size branch from 87f1e1b to ffb171d Compare February 18, 2024 23:26
@akien-mga akien-mga changed the title AudioEffectPitchShift: Make fft_size unsigned AudioEffectPitchShift: Prevent negative size memset (GCC warning) Feb 18, 2024
@akien-mga akien-mga force-pushed the pitchshift-unsigned-fft-size branch from ffb171d to 3ba724e Compare February 18, 2024 23:30
@akien-mga akien-mga merged commit dbf5980 into godotengine:master Feb 20, 2024
16 checks passed
@akien-mga akien-mga deleted the pitchshift-unsigned-fft-size branch February 20, 2024 16:13
@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant