[Groonga-commit] groonga/groonga at 78740ed [master] lz4: add max size check

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 21 22:22:59 JST 2014


Kouhei Sutou	2014-10-21 22:22:59 +0900 (Tue, 21 Oct 2014)

  New Revision: 78740ed908bb1103832688eaac6b82a3d7d77b8a
  https://github.com/groonga/groonga/commit/78740ed908bb1103832688eaac6b82a3d7d77b8a

  Message:
    lz4: add max size check

  Modified files:
    lib/store.c

  Modified: lib/store.c (+9 -0)
===================================================================
--- lib/store.c    2014-10-21 22:15:49 +0900 (041f203)
+++ lib/store.c    2014-10-21 22:22:59 +0900 (90309a3)
@@ -1363,9 +1363,18 @@ grn_ja_put_lz4(grn_ctx *ctx, grn_ja *ja, grn_id id,
   grn_rc rc;
   void *lvalue;
   int lvalue_len;
+
   if (value_len == 0) {
     return grn_ja_put_raw(ctx, ja, id, value, value_len, flags, cas);
   }
+
+  if (value_len > (uint32_t)LZ4_MAX_INPUT_SIZE) {
+    ERR(GRN_INVALID_ARGUMENT,
+        "[ja][lz4] too large value size: <%u>: max: <%d>",
+        value_len, LZ4_MAX_INPUT_SIZE);
+    return ctx->rc;
+  }
+
   lvalue_len = LZ4_compressBound(value_len);
 
   if (!(lvalue = GRN_MALLOC(lvalue_len + sizeof(uint64_t)))) { return GRN_NO_MEMORY_AVAILABLE; }
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index