aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/common/platform.h9
-rw-r--r--c/fuzz/decode_fuzzer.c5
2 files changed, 12 insertions, 2 deletions
diff --git a/c/common/platform.h b/c/common/platform.h
index f1c1dc7..7406f3f 100644
--- a/c/common/platform.h
+++ b/c/common/platform.h
@@ -209,8 +209,13 @@ OR:
#define BROTLI_TARGET_RISCV64
#endif
+#if defined(__loongarch_lp64)
+#define BROTLI_TARGET_LOONGARCH64
+#endif
+
#if defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \
- defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64)
+ defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64) || \
+ defined(BROTLI_TARGET_LOONGARCH64)
#define BROTLI_TARGET_64_BITS 1
#else
#define BROTLI_TARGET_64_BITS 0
@@ -269,7 +274,7 @@ OR:
#define BROTLI_UNALIGNED_READ_FAST (!!0)
#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \
defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY) || \
- defined(BROTLI_TARGET_RISCV64)
+ defined(BROTLI_TARGET_RISCV64) || defined(BROTLI_TARGET_LOONGARCH64)
/* These targets are known to generate efficient code for unaligned reads
* (e.g. a single instruction, not multiple 1-byte loads, shifted and or'd
* together). */
diff --git a/c/fuzz/decode_fuzzer.c b/c/fuzz/decode_fuzzer.c
index 46144e0..697f9bf 100644
--- a/c/fuzz/decode_fuzzer.c
+++ b/c/fuzz/decode_fuzzer.c
@@ -27,6 +27,11 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
size_t total_out = 0;
BrotliDecoderState* state = BrotliDecoderCreateInstance(0, 0, 0);
+ if (!state) {
+ // OOM is out-of-scope here.
+ free(buffer);
+ return 0;
+ }
if (addend == 0)
addend = size;