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

New resampler: ASan reports memcpy-param-overlap error #2635

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

New resampler: ASan reports memcpy-param-overlap error #2635

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.1
Reported for operating system, platform: Other, x86

Comments on the original bug report:

On 2017-09-26 04:46:03 +0000, Eric Wasylishen wrote:

Tested on https://hg.libsdl.org/SDL/rev/8ce1c541181d

To reproduce:

It stops for me on the line:
SDL_memcpy(cvt->buf, dst, cvt->len_cvt); /* !!! FIXME: remove this if we can get the resampler to work in-place again. */

and I confirmed the memcpy is overwriting its input:

(lldb) print (char *)dst - (char *)cvt->buf
(long) $3 = 60672
(lldb) print cvt->len_cvt
(int) $4 = 243232

On 2017-10-03 22:37:45 +0000, Eric Wasylishen wrote:

Changing the SDL_memcpy to a SDL_memmove fixes the ASan warning and seems to work..

If I understand right, the memcpy is copying "output" (which is directly after "input" in a single buffer), over top of "input", which is OK, it just needs to be a memmove instead of memcpy:

[ input ] [ output (possibly longer than input) ]

-->

[ output (possibly longer than input) ] [ unused ]

On 2017-10-11 02:32:18 +0000, Ryan C. Gordon wrote:

Yeah, you're right, this should be a memmove.

Fixed in https://hg.libsdl.org/SDL/rev/f882930f174f, thanks!

--ryan.

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

No branches or pull requests

1 participant