Michael Niedermayer
12b1338be3
avutil/mem: Optimize fill32() by unrolling and using 64bit
...
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-20 21:42:20 +01:00
Carl Eugen Hoyos
695b1d8111
lavu/mem: Allow allocations close to max_alloc_size with av_fast_realloc().
2018-01-04 05:39:18 +01:00
Carl Eugen Hoyos
21b5990da4
lavu/mem: Do not realloc in av_fast_realloc() if size == min_size.
...
This can avoid OOM for min_size close to FFmpeg's arbitrary alloc limits.
2018-01-01 22:30:22 +01:00
James Darnley
e2218ed8ce
avutil: add alignment needed for AVX-512
2017-12-24 22:02:41 +01:00
James Almer
4959f18a8e
Merge commit '04b0f0e371ff81b682274b574fb465ba4395c09f'
...
* commit '04b0f0e371ff81b682274b574fb465ba4395c09f':
mem: uninline av_malloc(z)_array()
Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 16:08:14 -03:00
Anton Khirnov
04b0f0e371
mem: uninline av_malloc(z)_array()
...
Inlining public functions hardcodes their implementation into the ABI,
so it should be avoided unless there is a very good reason for it. No
such reason exists in this case.
2017-04-26 09:05:28 +02:00
Clément Bœsch
3835283293
Merge commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08'
...
* commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08':
Drop memalign hack
Merged, as this may indeed be uneeded since
46e3936fb0
.
Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 08:54:44 +01:00
Diego Biurrun
4fb311c804
Drop memalign hack
...
It no longer serves a useful purpose.
2016-09-03 15:11:29 +02:00
Timothy Gu
04da20e58f
dynarray: Change AV_ to FF_ for AV_DYNARRAY_ADD
...
The header is not installed and the macro isn't used outside libavutil,
so it is obviously privat to libavutil. Make the name reflect that.
2016-07-31 10:19:03 -07:00
Zhao Zhili
65b2feb890
avutil/mem: fix memleak
...
The original code assumes av_realloc() will free ptr if size is zero.
The assumes is incorrect now.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-28 12:09:05 +02:00
Michael Niedermayer
fc91eeab0b
avutil/mem: Add av_fast_mallocz()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-18 22:05:16 +01:00
Michael Niedermayer
d6ff68ad85
Factor duplicated ff_fast_malloc() out into mem_internal.h
...
internal.h is difficult to use due to circular dependancies
mem.h is a public header ff_* is not public
Alternative solutions probably are possible too
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-13 02:41:43 +02:00
Michael Niedermayer
b3415e4c5f
avutil/mem: Fix potential overflow in overallocation code
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-11 22:47:09 +02:00
Michael Niedermayer
4950bd4ebe
libavutil/mem: use size_t for the length in av_strdup()
...
the string length is not constrained to INT_MAX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-10 16:06:50 +02:00
Michael Niedermayer
63186ac5f1
avutil/mem: replace remaining void **/*** casts by memcpy()
...
This is similar to 6039248018
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 14:28:56 +01:00
Michael Niedermayer
fa73358c9b
Merge commit '60392480181f24ebf3ab48d8ac3614705de90152'
...
* commit '60392480181f24ebf3ab48d8ac3614705de90152':
mem: fix pointer pointer aliasing violations
Conflicts:
libavutil/mem.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-01 13:52:22 +01:00
Rémi Denis-Courmont
6039248018
mem: fix pointer pointer aliasing violations
...
This uses explicit memory copying to read and write pointer to pointers
of arbitrary object types. This works provided that the architecture
uses the same representation for all pointer types (the previous code
made that assumption already anyway).
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-01 02:28:40 +01:00
Michael Niedermayer
c8571c61ec
Merge commit '8ddc32629a6d6be77256694c9e322dde134609f3'
...
* commit '8ddc32629a6d6be77256694c9e322dde134609f3':
mem: add av_strndup() for duplicating substrings
Conflicts:
libavutil/mem.c
libavutil/mem.h
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-14 00:29:06 +02:00
Anton Khirnov
8ddc32629a
mem: add av_strndup() for duplicating substrings
2014-08-13 17:24:18 +00:00
Lukasz Marek
cd50a44beb
lavu/mem: add av_dynarray_add_nofree function
...
av_dynarray_add_nofree function have similar functionality
as existing av_dynarray_add, but it doesn't deallocate memory
on fails.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
2014-03-29 09:48:48 +01:00
Michael Niedermayer
9ba1190297
avutil/mem: avoid using intptr_t to access void* in av_dynarray_add()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-22 21:14:57 +01:00
Nicolas George
b0dcf76530
lavu/mem: reimplement the dynarray functions with the macro.
...
Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-22 20:53:36 +01:00
Michael Niedermayer
7c888ae746
Merge commit 'cce3e0a49f0dd030262c28d9c53de0bd2fd909c4'
...
* commit 'cce3e0a49f0dd030262c28d9c53de0bd2fd909c4':
Move av_fast_{m,re}alloc from lavc to lavu.
Conflicts:
libavcodec/avcodec.h
libavcodec/utils.c
libavutil/mem.c
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-14 15:04:04 +01:00
Anton Khirnov
cce3e0a49f
Move av_fast_{m,re}alloc from lavc to lavu.
2013-11-14 09:42:22 +01:00
Michael Niedermayer
21b3563dcb
Merge remote-tracking branch 'qatar/master'
...
* qatar/master:
mem: Make av_strdup allocate using av_realloc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-17 08:13:42 +02:00
Martin Storsjö
d433e1aefa
mem: Make av_strdup allocate using av_realloc
...
This makes sure that pointers from av_strdup are reallocable,
which is used in av_dict_set if the AV_DICT_APPEND flag is set.
Nothing should rely on pointers from av_strdup being aligned.
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-10-16 18:59:01 +03:00
Michael Niedermayer
6c169c2fa4
Merge commit '67e285ceca1cb602a5ab87010b30d904527924fe'
...
* commit '67e285ceca1cb602a5ab87010b30d904527924fe':
mem: Handle av_reallocp(..., 0) properly
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 09:36:58 +02:00
Martin Storsjö
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>
2013-09-20 21:23:08 +03:00
Michael Niedermayer
c74c3fb142
Merge commit '3feb3d6ce4be0a09a9f8f13d613bed25b523b6e7'
...
* commit '3feb3d6ce4be0a09a9f8f13d613bed25b523b6e7':
mem: Introduce av_reallocp
Conflicts:
doc/APIchanges
libavutil/mem.c
libavutil/mem.h
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-17 11:06:26 +02:00
Luca Barbato
3feb3d6ce4
mem: Introduce av_reallocp
2013-09-16 19:36:37 +02:00
Michael Niedermayer
5866c107a9
Merge commit 'c3e6e8f06c42499bd020fd0b37f9542150e6067b'
...
* commit 'c3e6e8f06c42499bd020fd0b37f9542150e6067b':
mem: Do not check unsigned values for negative size
Conflicts:
libavutil/mem.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-06 12:21:16 +02:00
Michael Niedermayer
92424a45d0
Merge commit 'b634b36fcebfe16b837b6c4044f5d5cb99a75040'
...
* commit 'b634b36fcebfe16b837b6c4044f5d5cb99a75040':
mem: Improve documentation wording and spelling
Conflicts:
libavutil/mem.c
libavutil/mem.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-06 12:05:02 +02:00
Diego Biurrun
c3e6e8f06c
mem: Do not check unsigned values for negative size
2013-09-05 12:38:43 +02:00
Diego Biurrun
b634b36fce
mem: Improve documentation wording and spelling
2013-09-05 12:38:43 +02:00
Michael Niedermayer
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>
2013-08-09 13:47:10 +02:00
Michael Niedermayer
fbc472da29
avutil/mem: simplify av_reallocp_array() by using av_realloc_f()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-05 14:40:31 +02:00
Michael Niedermayer
30b491f1c9
Merge commit '3b4feac1ec14f861bdd7f494f288f4d8dd7f449e'
...
* commit '3b4feac1ec14f861bdd7f494f288f4d8dd7f449e':
movenc: Keep track of the allocated size for the cluster array
mem: Add av_realloc_array and av_reallocp_array
Conflicts:
doc/APIchanges
libavformat/movenc.c
libavutil/mem.c
libavutil/mem.h
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-05 11:19:16 +02:00
Martin Storsjö
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>
2013-06-04 15:04:08 +03:00
Stefano Sabatini
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
2013-05-13 13:52:31 +02:00
Stefano Sabatini
84be806982
lavu: define FF_MEMORY_POISON and use it
...
Allow single-place definition of constant used to fill poisoned memory.
2013-05-13 13:52:26 +02:00
Stefano Sabatini
ee9794ed20
lavu/mem: fix potential int overflow and crash in av_dynarray_add()
...
Also extend documentation accordingly.
2013-05-08 01:39:12 +02:00
Michael Niedermayer
89b5039ff2
avutil/mem: add av_memdup()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-02 13:44:05 +02:00
Stefano Sabatini
1c1a2d1319
lavu/mem: remove redundant comment from av_dynarray_add()
...
The function is documented in mem.h.
2013-04-27 20:34:10 +02:00
Fabrizio Gennari
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>
2013-03-10 11:12:56 +01:00
Michael Niedermayer
4ba35194a9
Merge commit 'f935aca44c674d30e3ed940ef73bbad1228a5855'
...
* commit 'f935aca44c674d30e3ed940ef73bbad1228a5855':
av_memcpy_backptr: avoid an infinite loop for back = 0
4xm: check the return value of read_huffman_tables().
Conflicts:
libavcodec/4xm.c
libavutil/mem.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-24 12:22:51 +01:00
Anton Khirnov
f935aca44c
av_memcpy_backptr: avoid an infinite loop for back = 0
...
CC:libav-stable@libav.org
2013-02-23 09:16:15 +01:00
Michael Niedermayer
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>
2013-02-22 20:42:33 +01:00
Michael Niedermayer
58f30175e1
mem: minor simplification of the alignment hack code
...
Idea-by: wanzhang
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-14 05:36:22 +01:00
Michael Niedermayer
99efd59626
Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
...
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
Remove pointless #undefs of previously forbidden functions.
fate: Add dependencies for bmp, cdxl, dfa, mp3
Conflicts:
doc/examples/muxing.c
libavfilter/filtfmts.c
libavutil/des.c
libavutil/eval.c
libavutil/log.c
libavutil/parseutils.c
tests/fate/mp3.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-05 13:34:45 +01:00
Anton Khirnov
cb45553f57
Remove pointless #undefs of previously forbidden functions.
2012-12-04 21:40:22 +01:00