diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-04-28 17:06:34 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-04-28 17:06:34 +0300 |
commit | 3be21fb12f4cec2cf07799e8960382f4cb375369 (patch) | |
tree | a20ea08ae1eb3237a73cc68c2f0828a57f56e381 | |
parent | Prevent LZ encoder from hanging with known uncompressed (diff) | |
download | xz-3be21fb12f4cec2cf07799e8960382f4cb375369.tar.xz |
Fixed wrong spelling "limitter" to "limiter". This affects
liblzma's API.
-rw-r--r-- | doc/liblzma-security.txt | 14 | ||||
-rw-r--r-- | src/liblzma/api/lzma/base.h | 4 | ||||
-rw-r--r-- | src/liblzma/api/lzma/memlimit.h | 10 | ||||
-rw-r--r-- | src/liblzma/api/lzma/stream.h | 4 | ||||
-rw-r--r-- | src/liblzma/common/Makefile.am | 2 | ||||
-rw-r--r-- | src/liblzma/common/memory_limiter.c (renamed from src/liblzma/common/memory_limitter.c) | 2 | ||||
-rw-r--r-- | src/lzma/list.c | 6 | ||||
-rw-r--r-- | src/lzmadec/lzmadec.c | 12 | ||||
-rw-r--r-- | tests/test_memlimit.c | 4 |
9 files changed, 29 insertions, 29 deletions
diff --git a/doc/liblzma-security.txt b/doc/liblzma-security.txt index 487637ed..78947bd8 100644 --- a/doc/liblzma-security.txt +++ b/doc/liblzma-security.txt @@ -87,7 +87,7 @@ Using liblzma securely The simplest solution is to use setrlimit() if the kernel supports RLIMIT_AS, which limits the memory usage of the whole process. For more portable and fine-grained limitting, you can use - memory limitter functions found from <lzma/memlimit.h>. + memory limiter functions found from <lzma/memlimit.h>. 1.2.1. Encoder @@ -118,24 +118,24 @@ Using liblzma securely 1.2.2. Decoder - A single-threaded decoder should simply use a memory limitter and + A single-threaded decoder should simply use a memory limiter and indicate an error if it runs out of memory. Memory-limitting with multi-threaded decoding is tricky. The simple solution is to divide the maximum allowed memory usage with the maximum allowed threads, and give each Block decoder their own - independent lzma_memory_limitter. The drawback is that if one Block + independent lzma_memory_limiter. The drawback is that if one Block needs notably more RAM than any other Block, the decoder will run out of memory when in reality there would be plenty of free RAM. - An attractive alternative would be using shared lzma_memory_limitter. + An attractive alternative would be using shared lzma_memory_limiter. Depending on the application and the expected type of input, this may either be the best solution or a source of hard-to-repeat problems. Consider the following requirements: - You use at maximum of n threads. - x(i) is the decoder memory requirements of the Block number i in an expected input Stream. - - The memory limitter is set to higher value than the sum of n + - The memory limiter is set to higher value than the sum of n highest values x(i). (If you are better at explaining the above conditions, please @@ -150,7 +150,7 @@ Using liblzma securely Most .lzma files have all the Blocks encoded with identical settings, or at least the memory usage won't vary dramatically. That's why most multi-threaded decoders probably want to use the simple "separate - lzma_memory_limitter for each thread" solution, possibly fallbacking + lzma_memory_limiter for each thread" solution, possibly fallbacking to single-threaded mode in case the per-thread memory limits aren't enough in multi-threaded mode. @@ -206,7 +206,7 @@ FIXME: Memory usage of Stream info. creating a denial of service like piping decoded a Data Block to another process would do. - At first it would seem that using a memory limitter would prevent + At first it would seem that using a memory limiter would prevent this issue as a side effect. But it does so only if the application requests liblzma to allocate the Extra Records and provide them to the application. If Extra Records aren't requested, they aren't diff --git a/src/liblzma/api/lzma/base.h b/src/liblzma/api/lzma/base.h index e7edf531..d39bfe95 100644 --- a/src/liblzma/api/lzma/base.h +++ b/src/liblzma/api/lzma/base.h @@ -265,8 +265,8 @@ typedef struct { * custom memory allocation functions for use with liblzma. * * When using lzma_memory_alloc() and lzma_memory_free(), opaque - * must point to lzma_memory_limitter structure allocated and - * initialized with lzma_memory_limitter_create(). + * must point to lzma_memory_limiter structure allocated and + * initialized with lzma_memory_limiter_create(). * * If you don't need this, you should set it to NULL. */ diff --git a/src/liblzma/api/lzma/memlimit.h b/src/liblzma/api/lzma/memlimit.h index c0449f2b..6b07679d 100644 --- a/src/liblzma/api/lzma/memlimit.h +++ b/src/liblzma/api/lzma/memlimit.h @@ -1,6 +1,6 @@ /** * \file lzma/memlimit.h - * \brief Memory usage limitter + * \brief Memory usage limiter * * \author Copyright (C) 1999-2006 Igor Pavlov * \author Copyright (C) 2007 Lasse Collin @@ -39,7 +39,7 @@ typedef struct lzma_memlimit_s lzma_memlimit; * to these functions can be used in lzma_allocator structure, which makes * it easy to limit memory usage with liblzma. * - * The memory limitter functions are not tied to limitting memory usage + * The memory limiter functions are not tied to limitting memory usage * with liblzma itself. You can use them with anything you like. * * In multi-threaded applications, only one thread at once may use the same @@ -128,7 +128,7 @@ extern lzma_bool lzma_memlimit_reached(lzma_memlimit *mem, lzma_bool clear); /** - * \brief Gets the number of allocations owned by the memory limitter + * \brief Gets the number of allocations owned by the memory limiter * * The count does not include the helper structures; if no memory has * been allocated with lzma_memlimit_alloc() or all memory allocated @@ -189,9 +189,9 @@ extern void lzma_memlimit_free(lzma_memlimit *mem, void *ptr); /** - * \brief Frees the memory allocated for and by the memory usage limitter + * \brief Frees the memory allocated for and by the memory usage limiter * - * \param mem Pointer to memory limitter + * \param mem Pointer to memory limiter * \param free_allocated If this is non-zero, all the memory allocated * by lzma_memlimit_alloc() using *mem is also * freed if it hasn't already been freed with diff --git a/src/liblzma/api/lzma/stream.h b/src/liblzma/api/lzma/stream.h index d111be37..346bdd17 100644 --- a/src/liblzma/api/lzma/stream.h +++ b/src/liblzma/api/lzma/stream.h @@ -169,8 +169,8 @@ extern lzma_ret lzma_stream_encoder_multi( * completely when lzma_code() returns LZMA_STREAM_END. If *footer is still * NULL, there was no Extra field in the Footer Metadata Block. * - * \note If you use lzma_memory_limitter, the Extra Records will be - * allocated with it, and thus remain in the lzma_memory_limitter + * \note If you use lzma_memory_limiter, the Extra Records will be + * allocated with it, and thus remain in the lzma_memory_limiter * even after they get exported to the application via *header * and *footer pointers. */ diff --git a/src/liblzma/common/Makefile.am b/src/liblzma/common/Makefile.am index c650a34c..c76ce14f 100644 --- a/src/liblzma/common/Makefile.am +++ b/src/liblzma/common/Makefile.am @@ -31,7 +31,7 @@ libcommon_la_SOURCES = \ index.c \ info.c \ init.c \ - memory_limitter.c \ + memory_limiter.c \ memory_usage.c \ next_coder.c \ raw_common.c \ diff --git a/src/liblzma/common/memory_limitter.c b/src/liblzma/common/memory_limiter.c index e6aa6300..a2a0cbdc 100644 --- a/src/liblzma/common/memory_limitter.c +++ b/src/liblzma/common/memory_limiter.c @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -/// \file memory_limitter.c +/// \file memory_limiter.c /// \brief Limitting memory usage // // Copyright (C) 2007 Lasse Collin diff --git a/src/lzma/list.c b/src/lzma/list.c index 61eb5702..e59f28b7 100644 --- a/src/lzma/list.c +++ b/src/lzma/list.c @@ -328,9 +328,9 @@ parse_stream_tail(listing_handle *handle) static void list_native(listing_handle *handle) { - lzma_memory_limitter *limitter - = lzma_memory_limitter_create(opt_memory); - if (limitter == NULL) { + lzma_memory_limiter *limiter + = lzma_memory_limiter_create(opt_memory); + if (limiter == NULL) { errmsg(V_ERROR, } lzma_info *info = diff --git a/src/lzmadec/lzmadec.c b/src/lzmadec/lzmadec.c index eca58b98..f92deadd 100644 --- a/src/lzmadec/lzmadec.c +++ b/src/lzmadec/lzmadec.c @@ -482,15 +482,15 @@ main(int argc, char **argv) lzma_init_decoder(); - lzma_memlimit *mem_limitter = lzma_memlimit_create(mem_limit); - if (mem_limitter == NULL) { + lzma_memlimit *mem_limiter = lzma_memlimit_create(mem_limit); + if (mem_limiter == NULL) { fprintf(stderr, "%s: %s\n", argv0, strerror(ENOMEM)); exit(ERROR); } - assert(lzma_memlimit_count(mem_limitter) == 0); + assert(lzma_memlimit_count(mem_limiter) == 0); - allocator.opaque = mem_limitter; + allocator.opaque = mem_limiter; strm.allocator = &allocator; #ifdef WIN32 @@ -528,8 +528,8 @@ main(int argc, char **argv) // Free the memory only when debugging. Freeing wastes some time, // but allows detecting possible memory leaks with Valgrind. lzma_end(&strm); - assert(lzma_memlimit_count(mem_limitter) == 0); - lzma_memlimit_end(mem_limitter, false); + assert(lzma_memlimit_count(mem_limiter) == 0); + lzma_memlimit_end(mem_limiter, false); #endif return exit_status; diff --git a/tests/test_memlimit.c b/tests/test_memlimit.c index 8b156401..166e45b5 100644 --- a/tests/test_memlimit.c +++ b/tests/test_memlimit.c @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////// // /// \file test_memlimit.c -/// \brief Tests the memory usage limitter +/// \brief Tests the memory usage limiter /// /// \note These tests cannot be done at exact byte count accuracy, -/// because memory limitter takes into account the memory wasted +/// because memory limiter takes into account the memory wasted /// by bookkeeping structures and alignment (padding). // // Copyright (C) 2008 Lasse Collin |