67e285ceca 
								
							
								 
							
						 
						
							
							
								
								mem: Handle av_reallocp(..., 0) properly  
							
							Previously this did a double free (and returned an error).
Reported-by: Justin Ruggles
Signed-off-by: Martin Storsjö <martin@martin.st> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								3feb3d6ce4 
								
							
								 
							
						 
						
							
							
								
								mem: Introduce av_reallocp  
							
							
								
							
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								c3e6e8f06c 
								
							
								 
							
						 
						
							
							
								
								mem: Do not check unsigned values for negative size  
							
							
								
							
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								b634b36fce 
								
							
								 
							
						 
						
							
							
								
								mem: Improve documentation wording and spelling  
							
							
								
							
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								c94f9e8542 
								
							
								 
							
						 
						
							
							
								
								avutil/mem: Fix flipped condition  
							
							Fixes return code and later null pointer dereference
Found-by: Laurent Butti <laurentb@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								fbc472da29 
								
							
								 
							
						 
						
							
							
								
								avutil/mem: simplify av_reallocp_array() by using av_realloc_f()  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								fc962d4e7a 
								
							
								 
							
						 
						
							
							
								
								mem: Add av_realloc_array and av_reallocp_array  
							
							These help avoiding overflows and simplify error handling.
Signed-off-by: Martin Storsjö <martin@martin.st> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								e3984166a4 
								
							
								 
							
						 
						
							
							
								
								lavu/mem: add av_dynarray2_add()  
							
							Based on a patch by Clément Bœsch.
See thread:
From: Clément Bœsch <ubitux@gmail.com>
Subject: [FFmpeg-devel] [PATCH 1/5] lavu: add av_dynarray_alloc_elem().
Date: Sun, 14 Apr 2013 03:07:54 +0200 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								84be806982 
								
							
								 
							
						 
						
							
							
								
								lavu: define FF_MEMORY_POISON and use it  
							
							Allow single-place definition of constant used to fill poisoned memory. 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								ee9794ed20 
								
							
								 
							
						 
						
							
							
								
								lavu/mem: fix potential int overflow and crash in av_dynarray_add()  
							
							Also extend documentation accordingly. 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								89b5039ff2 
								
							
								 
							
						 
						
							
							
								
								avutil/mem: add av_memdup()  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								1c1a2d1319 
								
							
								 
							
						 
						
							
							
								
								lavu/mem: remove redundant comment from av_dynarray_add()  
							
							The function is documented in mem.h. 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								91b747ac78 
								
							
								 
							
						 
						
							
							
								
								mem: Fix usage of memalign() on DJGPP.  
							
							Credits to Khusraw of bttr-software.de forum.
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								f935aca44c 
								
							
								 
							
						 
						
							
							
								
								av_memcpy_backptr: avoid an infinite loop for back = 0  
							
							CC:libav-stable@libav.org 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								2c21d34ea4 
								
							
								 
							
						 
						
							
							
								
								avutil/mem: do a small set of checks for memalign hack before freeing.  
							
							These can detect some kinds of memory and or pointer corruptions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						12 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								58f30175e1 
								
							
								 
							
						 
						
							
							
								
								mem: minor simplification of the alignment hack code  
							
							Idea-by: wanzhang
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								cb45553f57 
								
							
								 
							
						 
						
							
							
								
								Remove pointless #undefs of previously forbidden functions.  
							
							
								
							
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								4a606c830a 
								
							
								 
							
						 
						
							
							
								
								av_memcpy_backptr: optimise some special cases  
							
							- Add special cases for offsets of 2, 3, or 4 bytes.  This means the
  offset is always >4 in the generic case, allowing 32-bit copies to
  be used there.
- Don't use memcpy() for sizes less than 16 bytes.
Signed-off-by: Mans Rullgard <mans@mansr.com> 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								5bac2d0c30 
								
							
								 
							
						 
						
							
							
								
								avutil: Move memcpy_backptr() to mem.c  
							
							The function is used elsewhere and does not belong with the LZO code. 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								5532cf3178 
								
							
								 
							
						 
						
							
							
								
								avutil/mem: K&R formatting cosmetics  
							
							
								
							
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								620b1e7e98 
								
							
								 
							
						 
						
							
							
								
								mem: Don't abort on av_malloc(0) in debug mode  
							
							This makes the behaviour consistent between debug and release mode.
Signed-off-by: Martin Storsjö <martin@martin.st> 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								7c84e7d337 
								
							
								 
							
						 
						
							
							
								
								mem: heap memory poisoning.  
							
							Enable it by default with FATE.
limitation: not random, and not supported with realloc. 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								be1a839ca6 
								
							
								 
							
						 
						
							
							
								
								mem: add support for _aligned_malloc() as found on Windows  
							
							The check uses check_func_header, since this function is
conditionally available depending on the targeted MSVCRT
version.
Signed-off-by: Martin Storsjö <martin@martin.st> 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								1a65d50ee7 
								
							
								 
							
						 
						
							
							
								
								mem.c: fix wrong comment.  
							
							Overwriting the av_malloc etc. functions is not easily
possible anymore, even for systems that support overriding
symbols in shared libraries in principle.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								14f063d294 
								
							
								 
							
						 
						
							
							
								
								mem: Consistently return NULL for av_malloc(0)  
							
							Plain POSIX malloc(0) is allowed to return either NULL or a
non-NULL pointer. The calling code should be ready to handle
a NULL return as a correct return (instead of a failure) if the size
to allocate was 0 - this makes sure the condition is handled
in a consistent way across platforms.
This also avoids calling posix_memalign(&ptr, 32, 0) on OS X,
which returns an invalid pointer (a non-NULL pointer that causes
crashes when passed to av_free).
Abort in debug mode, to help track down issues related to
incorrect handling of this case.
Signed-off-by: Martin Storsjö <martin@martin.st> 
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								7181c4edee 
								
							
								 
							
						 
						
							
							
								
								cosmetics: Remove extra newlines at EOF  
							
							
								
							
							
						 
						13 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								5a8e994287 
								
							
								 
							
						 
						
							
							
								
								mem: add av_max_alloc() to limit the maximum amount that may be allocated in one piece  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								bed04e2b03 
								
							
								 
							
						 
						
							
							
								
								Correct use of OSX to Mac OS X and properly format yasm providers on Mac OS X  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								fc11927890 
								
							
								 
							
						 
						
							
							
								
								mem: fix memalign hack av_realloc()  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								5cd754bca2 
								
							
								 
							
						 
						
							
							
								
								Introduce av_realloc_f.  
							
							av_realloc_f helps avoiding memory-leaks in typical uses of realloc.
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								ccecab4a0d 
								
							
								 
							
						 
						
							
							
								
								Add av_calloc() helper.  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								a39bd458a0 
								
							
								 
							
						 
						
							
							
								
								mem: Trying to workaround posix_memalign() bug on OSX  
							
							This patch is based on a patch by John Stebbins
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								6b4c0be558 
								
							
								 
							
						 
						
							
							
								
								mem: define the MAX_MALLOC_SIZE constant and use it in place of INT_MAX  
							
							This makes re-dimensionating the constant simpler, since now it is
defined only in one place. 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								518cdff81f 
								
							
								 
							
						 
						
							
							
								
								Fix posix_memalign() usage when libavutil is compiled outside FFmpeg.  
							
							To use posix_memalign() "#define _XOPEN_SOURCE 600" have to be defined.
FFmpeg configure defines it from the command line through config.mak,
but when libavutil is used outside of FFmpeg the define is missing.
Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								08675bb399 
								
							
								 
							
						 
						
							
							
								
								mem: Choose alignment at compile time depending on AVX enabledness.  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								c8981edd90 
								
							
								 
							
						 
						
							
							
								
								Only add 1 byte to av_malloc(0) when it actually returned NULL  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								91ff05f6ac 
								
							
								 
							
						 
						
							
							
								
								Make av_realloc(0) behave like our av_malloc(0)  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								35ceaa7376 
								
							
								 
							
						 
						
							
							
								
								Move ff_dynarray_add to lavu and make it public.  
							
							
								
							
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								5a36783bc4 
								
							
								 
							
						 
						
							
							
								
								Fix all malloc(0) issues  
							
							Signed-off-by: Michael Niedermayer <michaelni@gmx.at> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								13dfce3d44 
								
							
								 
							
						 
						
							
							
								
								Increase alignment of av_malloc() as needed by AVX ASM.  
							
							Signed-off-by: Reinhard Tartler <siretart@tauware.de> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								490a022d86 
								
							
								 
							
						 
						
							
							
								
								lavu: remove misc disabled cruft  
							
							
								
							
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								2912e87a6c 
								
							
								 
							
						 
						
							
							
								
								Replace FFmpeg with Libav in licence headers  
							
							Signed-off-by: Mans Rullgard <mans@mansr.com> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								0c8eb72ec5 
								
							
								 
							
						 
						
							
							
								
								Avoid pointless check before calling free  
							
							Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit dc75d6dbf2 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								dc75d6dbf2 
								
							
								 
							
						 
						
							
							
								
								Avoid pointless check before calling free  
							
							Signed-off-by: Mans Rullgard <mans@mansr.com> 
							
						 
						14 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								b47541c7a3 
								
							
								 
							
						 
						
							
							
								
								Change the argument of memory allocation functions from unsigned int to size_t  
							
							with the next major bump in libavutil.
Originally committed as revision 25871 to svn://svn.ffmpeg.org/ffmpeg/trunk 
							
						 
						15 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								ba87f0801d 
								
							
								 
							
						 
						
							
							
								
								Remove explicit filename from Doxygen  @file  commands.  
							
							Passing an explicit filename to this command is only necessary if the
documentation in the @file  block refers to a file different from the
one the block resides in.
Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk 
							
						 
						15 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								4ae406856f 
								
							
								 
							
						 
						
							
							
								
								Add --malloc-prefix to apply a prefix to malloc, free etc  
							
							This makes it easy to use a replacement allocator instead of the
system default one.
Originally committed as revision 21509 to svn://svn.ffmpeg.org/ffmpeg/trunk 
							
						 
						15 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								a90de11dba 
								
							
								 
							
						 
						
							
							
								
								Check return value of posix_memalign and explicitly set pointer to NULL if it  
							
							fails, patch by Patrik Kullman, patrik yes nu.
Originally committed as revision 17495 to svn://svn.ffmpeg.org/ffmpeg/trunk 
							
						 
						16 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								bad5537e2c 
								
							
								 
							
						 
						
							
							
								
								Use full internal pathname in doxygen  @file  directives.  
							
							Otherwise doxygen complains about ambiguous filenames when files exist
under the same name in different subdirectories.
Originally committed as revision 16912 to svn://svn.ffmpeg.org/ffmpeg/trunk 
							
						 
						16 years ago  
				
					
						
							
							
								 
						
							
							
							
								
							
								89c9ff504b 
								
							
								 
							
						 
						
							
							
								
								spelling/grammar/consistency review part I  
							
							Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk 
							
						 
						16 years ago