From 941a1c02fbb67a88692da7d60bdbad2552cbe911 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Thu, 18 Feb 2016 08:19:03 -0800 Subject: [PATCH] Increase size of biniou buffer, add logging in case of failure Summary:public Names of templated types can be very long. The default 4k characters is not long enough to handle folly library. Increase it to 16k characters and log when deserialization fails. Reviewed By: jberdine Differential Revision: D2948935 fb-gh-sync-id: a659b23 shipit-source-id: a659b23 --- infer/src/clang/cMain.ml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/infer/src/clang/cMain.ml b/infer/src/clang/cMain.ml index abeab109b..c29e46ffc 100644 --- a/infer/src/clang/cMain.ml +++ b/infer/src/clang/cMain.ml @@ -94,13 +94,24 @@ let print_usage_exit () = let () = Utils.Arg.parse arg_desc (fun _ -> ()) usage +let buffer_len = 16384 + (* This function reads the json file in fname, validates it, and encoded in the AST data structure*) (* defined in Clang_ast_t. *) let validate_decl_from_file fname = - Ag_util.Biniou.from_file Clang_ast_b.read_decl fname + try + Ag_util.Biniou.from_file ~len:buffer_len Clang_ast_b.read_decl fname + with (Invalid_argument "Bi_inbuf.refill_from_channel") -> + Printing.log_stats "WARNING: biniou buffer too short, skipping the file\n"; + assert false let validate_decl_from_stdin () = - Ag_util.Biniou.from_channel Clang_ast_b.read_decl stdin + try + Ag_util.Biniou.from_channel ~len:buffer_len Clang_ast_b.read_decl stdin + with (Invalid_argument "Bi_inbuf.refill_from_channel") -> + Printing.log_stats "WARNING: biniou buffer too short, skipping the file\n"; + assert false + let do_run source_path ast_path = try