From b8c5dc84ba75601759cb42ea2f052da5f6315f0e Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 9 Aug 2018 06:57:05 -0700 Subject: [PATCH] [absint] escape for xml when dumping info to html debug Summary: Fixes issues with printing templated stuff that looks suspiciously like HTML tags otherwise. Reviewed By: mbouaziz Differential Revision: D9239280 fbshipit-source-id: f008ce6da --- infer/src/absint/AbstractInterpreter.ml | 12 +++++++----- infer/src/absint/LowerHil.ml | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/infer/src/absint/AbstractInterpreter.ml b/infer/src/absint/AbstractInterpreter.ml index 7a0ff2acf..fa0d30d62 100644 --- a/infer/src/absint/AbstractInterpreter.ml +++ b/infer/src/absint/AbstractInterpreter.ml @@ -74,8 +74,9 @@ struct NodePrinter.start_session ~pp_name underlying_node ; let left, right, result = match op with `Join lrr | `Widen (_, lrr) -> lrr in L.d_strln - (Format.asprintf "LEFT: %a@.RIGHT: %a@.RESULT: %a@." Domain.pp left Domain.pp right Domain.pp - result) ; + ( Format.asprintf "LEFT: %a@.RIGHT: %a@.RESULT: %a@." Domain.pp left Domain.pp right + Domain.pp result + |> Escape.escape_xml ) ; NodePrinter.finish_session underlying_node @@ -93,9 +94,10 @@ struct in if debug then ( L.d_strln - (Format.asprintf "@[PRE: %a@]@\n@[INSTRS: %a@]@[POST: %a@]@." Domain.pp pre - (Instrs.pp Pp.(html Green)) - instrs Domain.pp astate_post) ; + ( Format.asprintf "@[PRE: %a@]@\n@[INSTRS: %a@]@[POST: %a@]@." Domain.pp pre + (Instrs.pp Pp.(html Green)) + instrs Domain.pp astate_post + |> Escape.escape_xml ) ; NodePrinter.finish_session (Node.underlying_node node) ) ; let inv_map' = InvariantMap.add node_id {pre; post= astate_post; visit_count} inv_map in (inv_map', Scheduler.schedule_succs work_queue node) diff --git a/infer/src/absint/LowerHil.ml b/infer/src/absint/LowerHil.ml index 440b1a51f..aa55153b9 100644 --- a/infer/src/absint/LowerHil.ml +++ b/infer/src/absint/LowerHil.ml @@ -34,8 +34,9 @@ struct let underyling_node = CFG.Node.underlying_node node in NodePrinter.start_session ~pp_name:(pp_session_name node) underyling_node ; L.d_strln - (Format.asprintf "PRE: %a@.INSTR: %a@.POST: %a@." TransferFunctions.Domain.pp pre - HilInstr.pp hil_instr TransferFunctions.Domain.pp post) ; + ( Format.asprintf "PRE: %a@.INSTR: %a@.POST: %a@." TransferFunctions.Domain.pp pre + HilInstr.pp hil_instr TransferFunctions.Domain.pp post + |> Escape.escape_xml ) ; NodePrinter.finish_session underyling_node )