commit 2210b330e757d234346191e5d05af761fe8561e6 Author: Alexander Færøy ahf@torproject.org Date: Tue Apr 25 03:36:30 2017 +0200
Fix newlines in compression headers.
See: https://bugs.torproject.org/21662 --- src/common/compress.h | 34 ++++++++++++++-------------------- src/common/compress_lzma.h | 36 ++++++++++++++---------------------- src/common/compress_zlib.h | 36 ++++++++++++++---------------------- src/common/compress_zstd.h | 36 ++++++++++++++---------------------- 4 files changed, 56 insertions(+), 86 deletions(-)
diff --git a/src/common/compress.h b/src/common/compress.h index 1e6e9fd..2d812e4 100644 --- a/src/common/compress.h +++ b/src/common/compress.h @@ -33,33 +33,27 @@ typedef enum { HIGH_COMPRESSION, MEDIUM_COMPRESSION, LOW_COMPRESSION } compression_level_t;
-int -tor_compress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method); -int -tor_uncompress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method, - int complete_only, - int protocol_warn_level); +int tor_compress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method); + +int tor_uncompress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method, + int complete_only, + int protocol_warn_level);
compress_method_t detect_compression_method(const char *in, size_t in_len);
-int -tor_compress_is_compression_bomb(size_t size_in, size_t size_out); +int tor_compress_is_compression_bomb(size_t size_in, size_t size_out);
-int -tor_compress_supports_method(compress_method_t method); +int tor_compress_supports_method(compress_method_t method);
-const char * -tor_compress_version_str(compress_method_t method); +const char *tor_compress_version_str(compress_method_t method);
-const char * -tor_compress_header_version_str(compress_method_t method); +const char *tor_compress_header_version_str(compress_method_t method);
-size_t -tor_compress_get_total_allocation(void); +size_t tor_compress_get_total_allocation(void);
/** Return values from tor_compress_process; see that function's documentation * for details. */ diff --git a/src/common/compress_lzma.h b/src/common/compress_lzma.h index 801e22d..71de56a 100644 --- a/src/common/compress_lzma.h +++ b/src/common/compress_lzma.h @@ -11,26 +11,21 @@ #ifndef TOR_COMPRESS_LZMA_H #define TOR_COMPRESS_LZMA_H
-int -tor_lzma_method_supported(void); +int tor_lzma_method_supported(void);
-const char * -tor_lzma_get_version_str(void); +const char *tor_lzma_get_version_str(void);
-const char * -tor_lzma_get_header_version_str(void); +const char *tor_lzma_get_header_version_str(void);
-int -tor_lzma_compress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method); +int tor_lzma_compress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method);
-int -tor_lzma_uncompress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method, - int complete_only, - int protocol_warn_level); +int tor_lzma_uncompress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method, + int complete_only, + int protocol_warn_level);
/** Internal state for an incremental LZMA compression/decompression. */ typedef struct tor_lzma_compress_state_t tor_lzma_compress_state_t; @@ -46,14 +41,11 @@ tor_lzma_compress_process(tor_lzma_compress_state_t *state, const char **in, size_t *in_len, int finish);
-void -tor_lzma_compress_free(tor_lzma_compress_state_t *state); +void tor_lzma_compress_free(tor_lzma_compress_state_t *state);
-size_t -tor_lzma_compress_state_size(const tor_lzma_compress_state_t *state); +size_t tor_lzma_compress_state_size(const tor_lzma_compress_state_t *state);
-size_t -tor_lzma_get_total_allocation(void); +size_t tor_lzma_get_total_allocation(void);
#endif // TOR_COMPRESS_LZMA_H.
diff --git a/src/common/compress_zlib.h b/src/common/compress_zlib.h index 0b1aad8..6e8e5c5 100644 --- a/src/common/compress_zlib.h +++ b/src/common/compress_zlib.h @@ -11,26 +11,21 @@ #ifndef TOR_COMPRESS_ZLIB_H #define TOR_COMPRESS_ZLIB_H
-int -tor_zlib_method_supported(void); +int tor_zlib_method_supported(void);
-const char * -tor_zlib_get_version_str(void); +const char *tor_zlib_get_version_str(void);
-const char * -tor_zlib_get_header_version_str(void); +const char *tor_zlib_get_header_version_str(void);
-int -tor_zlib_compress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method); +int tor_zlib_compress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method);
-int -tor_zlib_uncompress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method, - int complete_only, - int protocol_warn_level); +int tor_zlib_uncompress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method, + int complete_only, + int protocol_warn_level);
/** Internal state for an incremental zlib/gzip compression/decompression. */ typedef struct tor_zlib_compress_state_t tor_zlib_compress_state_t; @@ -46,14 +41,11 @@ tor_zlib_compress_process(tor_zlib_compress_state_t *state, const char **in, size_t *in_len, int finish);
-void -tor_zlib_compress_free(tor_zlib_compress_state_t *state); +void tor_zlib_compress_free(tor_zlib_compress_state_t *state);
-size_t -tor_zlib_compress_state_size(const tor_zlib_compress_state_t *state); +size_t tor_zlib_compress_state_size(const tor_zlib_compress_state_t *state);
-size_t -tor_zlib_get_total_allocation(void); +size_t tor_zlib_get_total_allocation(void);
#endif // TOR_COMPRESS_ZLIB_H.
diff --git a/src/common/compress_zstd.h b/src/common/compress_zstd.h index b2297bd..663cbdd 100644 --- a/src/common/compress_zstd.h +++ b/src/common/compress_zstd.h @@ -11,26 +11,21 @@ #ifndef TOR_COMPRESS_ZSTD_H #define TOR_COMPRESS_ZSTD_H
-int -tor_zstd_method_supported(void); +int tor_zstd_method_supported(void);
-const char * -tor_zstd_get_version_str(void); +const char *tor_zstd_get_version_str(void);
-const char * -tor_zstd_get_header_version_str(void); +const char *tor_zstd_get_header_version_str(void);
-int -tor_zstd_compress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method); +int tor_zstd_compress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method);
-int -tor_zstd_uncompress(char **out, size_t *out_len, - const char *in, size_t in_len, - compress_method_t method, - int complete_only, - int protocol_warn_level); +int tor_zstd_uncompress(char **out, size_t *out_len, + const char *in, size_t in_len, + compress_method_t method, + int complete_only, + int protocol_warn_level);
/** Internal state for an incremental Zstandard compression/decompression. */ typedef struct tor_zstd_compress_state_t tor_zstd_compress_state_t; @@ -46,14 +41,11 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state, const char **in, size_t *in_len, int finish);
-void -tor_zstd_compress_free(tor_zstd_compress_state_t *state); +void tor_zstd_compress_free(tor_zstd_compress_state_t *state);
-size_t -tor_zstd_compress_state_size(const tor_zstd_compress_state_t *state); +size_t tor_zstd_compress_state_size(const tor_zstd_compress_state_t *state);
-size_t -tor_zstd_get_total_allocation(void); +size_t tor_zstd_get_total_allocation(void);
#endif // TOR_COMPRESS_ZSTD_H.