Re: work-around: the glibc adobe flash incompatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Once upon a time, John Reiser <jreiser@xxxxxxxxxxxx> said:
> For right now (the immediate present) a work-around is to use the 'memmove'
> subroutine as the resolution of any reference to the symbol 'memcpy'.
> The quick-and-dirty way to do this

It would probably be easier to use an LD_PRELOAD to load a wrapper to
change memcpy() with overlaps to memmove().  This would obviously slow
down all memcpy() calls, but maybe it could just be used for Flash (or
at least just for plugins).  Something like (untested):


/* Library preload to replacing overlapping memcpy() with memmove()
 *
 * Compile with:
 *   gcc -O2 -ldl -fpic -shared -o preload-memcpy.so preload-memcpy.c
 * Use like
 *   LD_PRELOAD=/path/to/preload-memcpy.so; export LD_PRELOAD
 *   <some command>
 */

#define _GNU_SOURCE
#include <string.h>
#include <dlfcn.h>
#include <assert.h>

static void * (*real_memcpy) (void *dest, const void *src, size_t n);
void *memcpy (void *dest, const void *src, size_t n)
{
	char *d = (char *) dest;
	char *s = (char *) src;

	if (((d < s) && ((d + n - 1) >= s)) ||
	    ((s < d) && ((s + n - 1) >= d)))
		return memmove (dest, src, n);
	if (! real_memcpy)
		assert (real_memcpy = dlsym (RTLD_NEXT, "memcpy"));
	return real_memcpy (dest, src, n);
}


-- 
Chris Adams <cmadams@xxxxxxxxxx>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux