about summary refs log tree commit diff
path: root/md4c/5d7c35973e5d.meta.patch
diff options
context:
space:
mode:
Diffstat (limited to 'md4c/5d7c35973e5d.meta.patch')
-rw-r--r--md4c/5d7c35973e5d.meta.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/md4c/5d7c35973e5d.meta.patch b/md4c/5d7c35973e5d.meta.patch
new file mode 100644
index 0000000..4bc8205
--- /dev/null
+++ b/md4c/5d7c35973e5d.meta.patch
@@ -0,0 +1,79 @@
+diff --git a/md4c/md4c.c b/md4c/md4c.c
+index a71ba3655909..d95fd7d5b7b7 100644
+--- a/md4c/md4c.c
++++ b/md4c/md4c.c
+@@ -29,7 +29,55 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <stdbool.h>
++#include <stdint.h>
+ 
++void klee_assume(uintptr_t x) {}
++void klee_mark_patch(uint64_t patch_num) {}
++
++bool __klee_runtime = true;
++void
++klee_make_symbolic(void *addr, size_t nbytes, const char *name)
++{
++  __klee_runtime = false;
++}
++
++int
++__choose(const char *switch_id)
++{
++  char *env = getenv(switch_id);
++  if (env == NULL)
++    return 0;
++  int result=atoi(env);
++  return result;
++}
++
++#define MAX_NAME_LENGTH 1000
++#define SYMBOLIC_OUTPUT_PROTO(type, typestr)        \
++type                                                \
++angelix_symbolic_output_##type(type expr, char* id) \
++{                                                   \
++  if (!__klee_runtime)                              \
++    return expr;                                    \
++  static int instance = 0;                          \
++  char name[MAX_NAME_LENGTH];                       \
++  sprintf(name, "out!%s!%d", id, instance++);       \
++  type s;                                           \
++  klee_make_symbolic(&s, sizeof(s), name);          \
++  klee_assume(s == expr);                           \
++  return s;                                         \
++}
++SYMBOLIC_OUTPUT_PROTO(int, "int")
++SYMBOLIC_OUTPUT_PROTO(long, "long")
++SYMBOLIC_OUTPUT_PROTO(size_t, "size_t")
++SYMBOLIC_OUTPUT_PROTO(bool, "bool")
++SYMBOLIC_OUTPUT_PROTO(char, "char")
++#undef SYMBOLIC_OUTPUT_PROTO
++
++#define ANGELIX_OUTPUT(type, expr, name) \
++  angelix_symbolic_output_##type((expr), (name))
++
++#define __COMPILE_42
+ 
+ /*****************************
+  ***  Miscellaneous Stuff  ***
+@@ -3726,7 +3774,17 @@ md_analyze_emph(MD_CTX* ctx, int mark_index)
+         if(opener != NULL) {
+             SZ opener_size = opener->end - opener->beg;
+             SZ closer_size = mark->end - mark->beg;
+-            MD_MARKCHAIN* opener_chain = md_mark_chain(ctx, mark_index);
++            MD_MARKCHAIN* opener_chain;
++char __choose2 = __choose("__SWITCH2");
++klee_make_symbolic(&__choose2, sizeof(__choose2), "__choose2");
++if (__choose2 == 0) {
++            opener_chain = md_mark_chain(ctx, mark_index);
++}
++#ifdef __COMPILE_42
++else if (__choose2 == 3) {
++            opener_chain = md_mark_chain(ctx, opener_index);
++}
++#endif
+ 
+             if(opener_size > closer_size) {
+                 opener_index = md_split_emph_mark(ctx, opener_index, closer_size);