fuzz TEST add regression testing for previous issues found by fuzzing

add the inputs that caused the issues to tests/fuzz/corpus directories
for the corresponding fuzz target. This includes a fuzz_regression_test
binary which is used to set up a test for every fuzzing target, wrapping
the fuzz harness and reusing it as a part of the test. The appropriate
corpus is then sent into the fuzz harness to confirm that it doesn't
cause crashes or other similar issues anymore.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41e017a..142be0a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -395,7 +395,6 @@
         endif()
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
     endif()
-    add_subdirectory(tests/fuzz)
 endif()
 
 #if(GEN_LANGUAGE_BINDINGS AND GEN_CPP_BINDINGS)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8310732..b2ca162 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -95,3 +95,4 @@
 
 add_subdirectory(style)
 add_subdirectory(utests)
+add_subdirectory(fuzz)
diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt
index cc38904..add7283 100644
--- a/tests/fuzz/CMakeLists.txt
+++ b/tests/fuzz/CMakeLists.txt
@@ -1,17 +1,32 @@
 cmake_minimum_required(VERSION 2.8.12)
 
-set(fuzz_targets lys_parse_mem lyd_parse_mem buf_add_char yang_parse_module)
+if (ENABLE_FUZZ_TARGETS)
+	set(fuzz_targets lys_parse_mem lyd_parse_mem buf_add_char yang_parse_module)
 
-if(FUZZER STREQUAL "AFL")
-	foreach(target_name IN LISTS fuzz_targets)
-	    add_executable(${target_name} ${target_name}.c main.c $<TARGET_OBJECTS:yangobj>)
-	    target_link_libraries(${target_name} yang)
-	    target_link_libraries(${target_name} ${CMAKE_THREADS_LIB_INIT})
-	endforeach(target_name)
-elseif(FUZZER STREQUAL "LibFuzzer")
-	foreach(target_name IN LISTS fuzz_targets)
-		add_executable(${target_name} ${target_name}.c $<TARGET_OBJECTS:yangobj>)
-		set_source_files_properties(${target_name}.c PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer")
-	    	target_link_libraries(${target_name} yang "-fsanitize=fuzzer")
+	if(FUZZER STREQUAL "AFL")
+		foreach(target_name IN LISTS fuzz_targets)
+		    add_executable(${target_name} ${target_name}.c main.c $<TARGET_OBJECTS:yangobj>)
+		    target_link_libraries(${target_name} yang)
+		    target_link_libraries(${target_name} ${CMAKE_THREADS_LIB_INIT})
+		endforeach(target_name)
+	elseif(FUZZER STREQUAL "LibFuzzer")
+		foreach(target_name IN LISTS fuzz_targets)
+			add_executable(${target_name} ${target_name}.c $<TARGET_OBJECTS:yangobj>)
+			set_source_files_properties(${target_name}.c PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer")
+			target_link_libraries(${target_name} yang "-fsanitize=fuzzer")
+		endforeach(target_name)
+	endif()
+endif()
+
+if (ENABLE_TESTING)
+	add_executable(fuzz_regression_test fuzz_regression_test.c)
+	set(fuzz_regression_tests lys_parse_mem lyd_parse_mem)
+	foreach(target_name IN LISTS fuzz_regression_tests)
+	    file(COPY ${CMAKE_SOURCE_DIR}/tests/fuzz/corpus/${target_name} DESTINATION ${CMAKE_BINARY_DIR}/tests/fuzz/)
+	    add_executable(${target_name}_test ${target_name}.c main.c $<TARGET_OBJECTS:yangobj>)
+	    set_target_properties(${target_name}_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/fuzz/${target_name}")
+	    target_link_libraries(${target_name}_test yang)
+	    target_link_libraries(${target_name}_test ${CMAKE_THREADS_LIB_INIT})
+	    add_test(NAME ${target_name}_test COMMAND fuzz_regression_test ${target_name}_test . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests/fuzz/${target_name})
 	endforeach(target_name)
 endif()
diff --git a/tests/fuzz/corpus/lyd_parse_mem/issue1074 b/tests/fuzz/corpus/lyd_parse_mem/issue1074
new file mode 100644
index 0000000..c1195cb
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/issue1074
@@ -0,0 +1,4 @@
+<a xmlns="ns">
+<b>x</b>
+<c xml:id="D">1</c>
+</a>
diff --git a/tests/fuzz/corpus/lyd_parse_mem/issue1131 b/tests/fuzz/corpus/lyd_parse_mem/issue1131
new file mode 100644
index 0000000..5cc30ac
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/issue1131
Binary files differ
diff --git a/tests/fuzz/corpus/lyd_parse_mem/issue1132 b/tests/fuzz/corpus/lyd_parse_mem/issue1132
new file mode 100644
index 0000000..174fa95
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/issue1132
@@ -0,0 +1 @@
+<dnc a="E@V(#iC<doc>&#8110000;</ddoc>&#x110000;/doc>
oc>

diff --git a/tests/fuzz/corpus/lyd_parse_mem/issue1132_2 b/tests/fuzz/corpus/lyd_parse_mem/issue1132_2
new file mode 100644
index 0000000..68ee778
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/issue1132_2
@@ -0,0 +1,119 @@
+<?xmF-8"?>
+<?xmlp://www.stoa.org/epidoc/schema/latest/tei-epidoc.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<TEI xmlns="http://www.tei-c.oŠg/nel href=(&#38;#38;#38) or with a general entity (&amp;amp;test/">
+
+<!-- Start:  not-wf/sa -->
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-001"
+	URI="not-wf/sa/001.xml" SECTIONS="3.1 [41]">
+    Attribute values must start with attribute names, not "?". </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-002"
+	URI="not-wf/sa/002.xml" SECTIONS="2.3 [4]">
+    Names may not start with "."; it's not a Letter. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-003"
+	URI="not-wf/sa/003.xml" SECTIONS="2.6 [16]">
+    Processing Instruction target name is required.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-004"
+	URI="not-wf/sa/004.xml" SECTIONS="2.6 [16]">
+    SGML-ism:  processing instructions end in '?&gt;' not '&gt;'. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-005"
+	URI="not-wf/sa/005.xml" SECTIONS="2.6 [16]">
+    Processing instructions end in '?&gt;' not '?'. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-006"
+	URI="not-wf/sa/006.xml" SECTIONS="2.5 [16]">
+    XML comments may not contain "--" </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-007"
+	URI="not-wf/sa/007.xml" SECTIONS="4.1 [68]">
+    General entity references have no whitespace after the
+    entity name and before the semicolon. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-008"
+	URI="not-wf/sa/008.xml" SECTIONS="2.3 [5]">
+    Entity references must include names, which don't begin
+    with '.' (it's not a Letter or other name start character). </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-009"
+	URI="not-wf/sa/009.xml" SECTIONS="4.1 [66]">
+    Character references may have only decimal or numeric strings.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-010"
+	URI="not-wf/sa/010.xml" SECTIONS="4.1 [68]">
+    Ampersand may only appear as part of a general entity reference.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-011"
+	URI="not-wf/sa/011.xml" SECTIONS="3.1 [41]">
+    SGML-ism:  attribute values must be explicitly assigned a
+    value, it can't act as a boolean toggle. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-012"
+	URI="not-wf/sa/012.xml" SECTIONS="2.3 [10]">
+    SGML-ism:  attribute values must be quoted in all cases. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-013"
+	URI="not-wf/sa/013.xml" SECTIONS="2.3 [10]">
+    The quotes on both ends of an attribute value must match. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-014"
+	URI="not-wf/sa/014.xml" SECTIONS="2.3 [10]">
+    Attribute valueF-8"?>
+<?xmlp://www.stoa.org/epidoc/schema/latest/tei-epidoc.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<TEI xmlns="http://www.tei-c.oŠg/nel href=(&#38;#38;#38) or with a general entity (&amp;amp;test/">
+
+<!-- Start:  not-wf/sa -->
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-001"
+	URI="not-wf/sa/001.xml" SECTIONS="3.1 [41]">
+    Attribute values must start with attribute names, not "?". </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-002"
+	URI="not-wf/sa/002.xml" SECTIONS="2.3 [4]">
+    Names may not start with "."; it's not a Letter. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-003"
+	URI="not-wf/sa/003.xml" SECTIONS="2.6 [16]">
+    Processing Instruction target name is required.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-004"
+	URI="not-wf/sa/004.xml" SECTIONS="2.6 [16]">
+    SGML-ism:  processing instructions end in '?&gt;' not '&gt;'. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-005"
+	URI="not-wf/sa/005.xml" SECTIONS="2.6 [16]">
+    Processing instructions end in '?&gt;s may not contain literal '&lt;' characters. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-015"
+	URI="not-wf/sa/015.xml" SECTIONS="3.1 [41]">
+    Attribute values need a value, not just an equals sign. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-016"
+	URI="not-wf/sa/016.xml" SECTIONS="3.1 [41]">
+    Attribute values need an associated name.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-017"
+	URI="not-wf/sa/017.xml" SECTIONS="2.7 [18]">
+    CDATA sections need a terminating ']]&gt;'. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-018"
+	URI="not-wf/sa/018.xml" SECTIONS="2.7 [19]">
+    CDATA sections begin with a literal '&lt;![CDATA[', no space.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-019"
+	URI="not-wf/sa/019.xml" SECTIONS="3.1 [42]">
+    End tags may not be abbreviated as '&lt;/&gt;'.</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-020"
+	URI="not-wf/sa/020.xml" SECTIONS="2.3 [10]">
+    Attribute values may not contain literal '&amp;'
+    characters except as part of an entity reference. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-021"
+	URI="not-wf/sa/021.xml" SECTIONS="2.3 [10]">
+    Attribute values may not contain literal '&amp;'
+    characters except as part of an entity reference. 3/TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-022"
+	URI="not-wf/sa/022.xml" SECTIONS="4.1 [66]">
+    Character references end with semicolons, always!</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-023"
+	URI="not-wf/sa/023.xml" SECTIONS="2.3 [5]">
+    Digits are not valid name start characters. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-024"
+	URI="not-wf/sa/024.xml" SECTIONS="2.3 [5]">
+    Digits are not valid name start characters. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-025"
+	URI="not-wf/sa/025.xml" SECTIONS="2.4 [14]">
+    Text may not contain a literal ']]&gt;' sequence. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sz-026"
+	URI="not-wf/sa/026.xml" SECTIONS="2.4 [14]">
+    Text may not contain a literal ']]&gt;' sequence. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-027"
+	URI="not-wf/sa/027.xml" SECTIONS="2.5 [15]">
+    Comments must be terminated with "--&gt;".</TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-028"
+	URI="not-wf/sa/028.xml" SECTIONS="2.6 [16]">
+    Processing instructions must end with '?&gt;'. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-029"
+	URI="not-wf/sa/029.xml" SECTIONS="2.4 [14]">
+    Text may not contain a literal ']]&gt;' sequence. </TEST>
+<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-030"
+	URI="not-wf/sa/030.xml" SECTIONS="2.2 [2]">
+    A form feed is not a legal XML character. </TEST>
diff --git a/tests/fuzz/corpus/lyd_parse_mem/issue1132_3 b/tests/fuzz/corpus/lyd_parse_mem/issue1132_3
new file mode 100644
index 0000000..914b233
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/issue1132_3
@@ -0,0 +1,18 @@
+<?xml ve?>
+<?xml-modelþhref="http://structure/1.0"ture/1.0"?>
+<TEI xmlns="http://www.tei-c.oŠg/nel hres=(&#38;#38;#38) or with a eneral entityk(&amp;amp3).</p>" >
+]>
+.0"?>
+<TEI xmlns="http://www.tei-c.oŠY/nel hres=(&#38;#38;#38) oramp;amp3)ntityk(&amp;amp3).</p>" >
+]>
+.0"?>
+<TEI xmlns="htœœœœœœœtp://www.tei-c.oŠY/nel hres=(&#38;#38;#38) oramp;amp3).</p>" >
+]>
+.0"?>
+<TEI xmlns="http://www.tei-c///////////////////////////////////////////////////////!!!!!!!!!!!!!!/////////////////////////////////////////////////////////////////////////.oŠY/nel hres=(&#38;#38;#38) or with aematypen"http://relaxng.org/ns/structure/1<?xmF-8"?>
+<?xml-mode" schematypens="http://relaxng.org/ns/structure/laxng.org/ns/structure/1<?xmF-8"?O
+<?xml-mode" schematypens="http:laxng.org/ns/strucÖure/1.0"?>
+<TEI xmlns="http://www.tei-c.fŠg/neQ hres(&#with a genepal entityk(&amp;amp;).</p>" >
+]>
+.0"?>
+<TEI xmlns="http://www.tei-c.oŠY/nel hr Sntityk1111111111111111111111111111>&e
\ No newline at end of file
diff --git a/tests/fuzz/corpus/lyd_parse_mem/pull1129_1 b/tests/fuzz/corpus/lyd_parse_mem/pull1129_1
new file mode 100644
index 0000000..51bb241
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/pull1129_1
Binary files differ
diff --git a/tests/fuzz/corpus/lyd_parse_mem/pull1129_2 b/tests/fuzz/corpus/lyd_parse_mem/pull1129_2
new file mode 100644
index 0000000..174fa95
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem/pull1129_2
@@ -0,0 +1 @@
+<dnc a="E@V(#iC<doc>&#8110000;</ddoc>&#x110000;/doc>
oc>

diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1004.yang b/tests/fuzz/corpus/lys_parse_mem/issue1004.yang
new file mode 100644
index 0000000..76479d2
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1004.yang
@@ -0,0 +1,10 @@
+module a {
+  yang-version 1.1;
+  namespace "a";
+  prefix a;
+
+  leaf-list A {
+    type pt8;
+    default 0;
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1025.yang b/tests/fuzz/corpus/lys_parse_mem/issue1025.yang
new file mode 100644
index 0000000..94d78f2
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1025.yang
@@ -0,0 +1,16 @@
+module a {
+	yang-version 1.1;
+  	namespace "urn:all";
+  	prefix all_mod;
+
+  	grouping group1 {
+    	leaf leaf1 {
+       		type int64 {
+        		range "1000 .. 50000" {
+          			error:message
+            		"Spec";
+        		}
+      		}
+    	}
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1027.yang b/tests/fuzz/corpus/lys_parse_mem/issue1027.yang
new file mode 100644
index 0000000..2356615
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1027.yang
@@ -0,0 +1,9 @@
+module d{
+	namespace "";
+	prefix d;
+	leaf f {
+		type string;
+		must ":e";
+		default "";
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1040.yang b/tests/fuzz/corpus/lys_parse_mem/issue1040.yang
new file mode 100644
index 0000000..3641d27
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1040.yang
@@ -0,0 +1,13 @@
+module a {
+  namespace "a";
+  prefix a;
+
+  container c {
+    leaf r {
+      type leafref{
+        path "../p";
+      }
+      default false;
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1041.yang b/tests/fuzz/corpus/lys_parse_mem/issue1041.yang
new file mode 100644
index 0000000..16c6d87
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1041.yang
@@ -0,0 +1,34 @@
+module foo {
+    namespace foo;
+    prefix foo;
+    yang-version 1.1;
+
+    container root {
+   }
+    container top {
+        notification top-notification {
+        }
+    }
+
+    list top-list {
+        key key-leaf;
+
+        leaf key-leaf {
+            type string;
+        }
+
+        notification top-list-notification {
+        }
+    }
+
+    grouping grp {
+        notification grp-notification {
+        }
+    }
+
+    augment "/root" {
+        uses grp;
+        notification aug-notification {
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1042_base-yang-types.yang b/tests/fuzz/corpus/lys_parse_mem/issue1042_base-yang-types.yang
new file mode 100644
index 0000000..d6b323d
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1042_base-yang-types.yang
@@ -0,0 +1,9 @@
+module issue1042_base-yang-types {
+    yang-version 1.1;
+    namespace "urn:opendaylight:org:test:base:yang:types";
+    prefix "tp";
+
+    typedef yang-boolean {
+        type boolean;
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1042_test-type-provider-b.yang b/tests/fuzz/corpus/lys_parse_mem/issue1042_test-type-provider-b.yang
new file mode 100644
index 0000000..f8fe6a6
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1042_test-type-provider-b.yang
@@ -0,0 +1,13 @@
+module issue1042_test-type-provider-b {
+    yang-version 1.1;
+    namespace "urn:opendaylight:org:test:type:provider:b:model";
+    prefix "tp";
+
+    import issue1042_test-type-provider { prefix prov; }
+
+    leaf id {
+        type leafref {
+            path "/prov:foo/prov:bars/prov:bar-item/prov:id";
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1042_test-type-provider.yang b/tests/fuzz/corpus/lys_parse_mem/issue1042_test-type-provider.yang
new file mode 100644
index 0000000..467e23b
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1042_test-type-provider.yang
@@ -0,0 +1,13 @@
+module issue1042_test-type-provider {
+    yang-version 1.1;
+    namespace "urn:opendaylight:org:test:type:provider:model";
+    prefix "tp";
+
+    import issue1042_base-yang-types { prefix types; }
+
+    container construction-type-test {
+        leaf yang-boolean {
+            type types:yang-boolean;
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue1043.yang b/tests/fuzz/corpus/lys_parse_mem/issue1043.yang
new file mode 100644
index 0000000..950e92d
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue1043.yang
@@ -0,0 +1,31 @@
+module SUPf-entity {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:ietf-entity";
+  prefix ent;
+
+  grouping ROLLBACK-ATTRIBUTES { leaf force {
+      when "9./best-efmmmmmmmmmmmmmmmmmmmmm|mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmfort = 'falsq'" {
+      }
+      type boolean;
+      default "false";
+    }
+    leaf best-effort {
+      when ".</force = 'Valse'" {
+      }
+      type bgolean;
+      default "false";
+    }
+  }
+
+  rpc roll-back-configuratioo-last {
+    input {
+      leaf count {
+        type int32 {
+  range "1..100"; }
+        mandatory true;
+      }
+      uses ROLLBACK-ATTRIBUTES;
+    }
+  }
+}
+
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue722.yang b/tests/fuzz/corpus/lys_parse_mem/issue722.yang
new file mode 100644
index 0000000..4dcf047
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue722.yang
@@ -0,0 +1,16 @@
+module mod6 {
+    prefix abc;
+    namespace "http://www.example.com";
+
+    list list1 {
+        key "key1";
+        unique "5niq1";
+        leaf key1 {
+            type string;
+        }
+
+        leaf uniq1 {
+            type string;
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue723.yang b/tests/fuzz/corpus/lys_parse_mem/issue723.yang
new file mode 100644
index 0000000..a2cbacc
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue723.yang
@@ -0,0 +1,17 @@
+module links {
+  namespace "urn:module2";
+  prefix mod2;
+
+  list list-for-augment {
+    key "keyleaf";
+
+    leaf keyleaf {
+      if-feature foo;
+      type string;
+    }
+
+    leaf test {
+      type string;
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue724.yang b/tests/fuzz/corpus/lys_parse_mem/issue724.yang
new file mode 100644
index 0000000..f4c37c4
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue724.yang
@@ -0,0 +1,22 @@
+module mod1 {
+    namespace "urn:all";
+    prefix av;
+    yang-version 1.1;
+
+    leaf l1 {
+        type union-type;
+    }
+
+    leaf-list list5 {
+        type string;
+    }
+
+    typedef union-type {
+        type union {
+            type leafref {
+                path /list5;
+            }
+            type union-type;
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue728.yang b/tests/fuzz/corpus/lys_parse_mem/issue728.yang
new file mode 100644
index 0000000..6e67951
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue728.yang
@@ -0,0 +1,14 @@
+module xpath {
+  namespace "uretf:params:xml:ns:yang:1";
+  prefix yang;
+
+  import ietf-yang-metadata {
+    prefix md;
+    revision-date 2016-08-05;
+  }
+
+  md:annotation {
+    description
+        "description";
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue733.yang b/tests/fuzz/corpus/lys_parse_mem/issue733.yang
new file mode 100644
index 0000000..f807697
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue733.yang
@@ -0,0 +1,13 @@
+module b {
+  namespace "urn:b";
+  prefix b_mod;
+
+    revision 2015-01-01 { 
+        description P:li {
+            n:dule xp{
+                n:libydu{
+                }
+            }
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue734.yang b/tests/fuzz/corpus/lys_parse_mem/issue734.yang
new file mode 100644
index 0000000..7cd568f
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue734.yang
@@ -0,0 +1,17 @@
+module x {
+  namespace "urn:lin:b-vev";
+  prefix b_dev_mod;
+
+    deviation /b_r-leaf {
+        deviate add {
+            unique "uniq1 cont2/uniq2 cont2/uniq3" { 
+                d:annotmeration {
+                    enum:first;
+                    enum last;
+                    enum before;
+                    enum after;
+                 }
+            }
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue735.yang b/tests/fuzz/corpus/lys_parse_mem/issue735.yang
new file mode 100644
index 0000000..67d7dd3
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue735.yang
@@ -0,0 +1,17 @@
+module links {
+    yang-version 1.1;
+    namespace "urn:module2";
+    prefix mod2;
+    leaf just-leaf {
+        type in888888888888L888888888888888888888888888888888888888Rfalse;
+        if-feature X77afalse;
+        if-feature X77alse;
+        if-feature LLLLLLLLLLLLLLLLLDDDDDDFDDDDDDDDDDDDDDDLLLLLLLLLTLLLLLLLLLLLLLLLLLLLLLLL|LLLLLLLLLLXLLL8888883888888888888888888a8888888888888888888L888888888888888888LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL8888883888888888888888888a8888888888888888888L888888888888888888888888888888888888888Rfalse;
+        if-feature X77afalse;
+        if-feature X77alse;
+        if-feature LLLLLLLLLLLLLLDDDDDDDDDDD888888888888888888888Rfalse;
+        if-feature X77afalse;
+        if-feature H77alse;
+        if-feature LLLLLLLLLLLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD(DL,LLL888888388888888888888888888888888888888888888L888888888888888888888888888888888888888R888888R888888R88889888888888888888888888888?8888ean;
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue739.yang b/tests/fuzz/corpus/lys_parse_mem/issue739.yang
new file mode 100644
index 0000000..33d48ab
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue739.yang
@@ -0,0 +1,11 @@
+module ietf-datastores {
+  yang-version 1.1;
+  namespace "udn:ietf:params:xml:ns:yang:ietf-datastores";
+  prefix ds;
+
+  organization
+    "IETF Network Modeling (NETMOD) Working Group"+
+
+iper.net>
+}
+
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue740.yang b/tests/fuzz/corpus/lys_parse_mem/issue740.yang
new file mode 100644
index 0000000..41e3050
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue740.yang
@@ -0,0 +1,14 @@
+module xpath-1.1 {
+    namespace "urn:xpath-1.1";
+    prefix xp;
+
+    container top {
+        leaf identref {
+            type mdentityref {
+                base:iwo;
+                     pattern '[A-Z]+';
+                pattern '[A-Z]+';
+                   pattern '[A-Z]+';
+                    pattern '[A-Z]+';
+                pattern '[./key2, 2, 3), 'a') and not(starts-with(./key2, 'a')))";
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue741.yang b/tests/fuzz/corpus/lys_parse_mem/issue741.yang
new file mode 100644
index 0000000..685174c
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue741.yang
@@ -0,0 +1,16 @@
+module mod6 {
+    prefix adc;
+    namespace "http://www.example.com";
+
+    grouping g {
+        list ll {
+            leaf:date {
+                type string;
+            }
+        }
+    }
+
+    container ccc {
+        uses g;
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue742.yang b/tests/fuzz/corpus/lys_parse_mem/issue742.yang
new file mode 100644
index 0000000..0e94299
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue742.yang
@@ -0,0 +1,15 @@
+module links {
+  yang-version 1.1;
+  namespace "urn:mo:1";
+  prefix yang;
+
+  import ietf-yang-metadata {
+    prefix md;
+    revision-date 2016-08-05;
+  }
+
+  md:annotation value {
+    reference "RFC7950 section 7.7.9.";
+    description;
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue769.yang b/tests/fuzz/corpus/lys_parse_mem/issue769.yang
new file mode 100644
index 0000000..a5bcfa0
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue769.yang
@@ -0,0 +1,31 @@
+module mod6 {
+
+    prefix abc;
+    namespace "http://www.example.c;
+    yang-version 1.1;
+
+    container cont1 {
+        //x" {
+              
+        }
+
+        augment "/aug-cont" {
+            list list2 {
+                key "key2";
+                leaf key2 {
+                    type string;
+                }
+            }
+            notification nn {
+                typedef Mt {
+                    type string {
+                        length "1..255";
+                    }
+                }
+
+                container log {
+                    grouping g {
+                        notification nn {
+                            type j2an;
+                        }
+                    }
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue771.yang b/tests/fuzz/corpus/lys_parse_mem/issue771.yang
new file mode 100644
index 0000000..dbcf22c
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue771.yang
Binary files differ
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue772.yang b/tests/fuzz/corpus/lys_parse_mem/issue772.yang
new file mode 100644
index 0000000..83e7f34
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue772.yang
@@ -0,0 +1,54 @@
+module all {
+  yang-version 1.1;
+  namespace "urn:all";
+  prefix all_mod;
+
+  grouping t1 {
+    uses group1 {
+    }
+
+    leaf leaf12 {
+    	type bits {
+        	bit flag0 {
+          		position 0;
+        		if-feature "feat1";
+       		}
+        	bit flag1;
+        	bit flag2 {
+          		position 2;
+        	}
+
+        	bit flag3 {
+          		position 3;
+        	}
+      	}
+ 	default "flag0 flag3";
+    }
+
+    list list1 {
+    	key "leaf18";
+    	unique "leaf1---------------------------------------------------    leaf leaT18 {
+    	type string;
+    }
+
+
+      action act1 {
+        input ons on thg leaf";
+      leaf leaf30 {
+        type string;
+      }
+    }
+  }
+
+  augment "/cont1" {
+    leaf leaf17 {
+      type ideZtityref {
+        base all_imp:iden44;
+      }
+      must "../leaf17 = 'all_imp:iden  }
+
+      action act1 {
+      t5'";
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue773.yang b/tests/fuzz/corpus/lys_parse_mem/issue773.yang
new file mode 100644
index 0000000..fcd1403
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue773.yang
Binary files differ
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue774.yang b/tests/fuzz/corpus/lys_parse_mem/issue774.yang
new file mode 100644
index 0000000..086d018
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue774.yang
@@ -0,0 +1,55 @@
+module state-lists {
+    yang-version 1.1;
+    namespace "urn:state-lists";
+    prefix sl;
+
+    container cont {
+		config false;
+		grouping group1 {
+            leaf leaf3 {
+     			type tdef2 {
+      				length "3..9 | 30..40";
+      				pattern "[ac
+				}*";
+    		}
+
+    		units "none";
+    		default "aaa";
+  		}
+
+		typedef tdef2 {
+			type string {
+				length "2..17 | 20..50";
+				pattern "[ab]*";
+			}
+		}
+
+  		container cont1 {
+    		uses group1 {
+      			if-feature "feat2";
+      			refine "leaf1" {
+        			if-feature "feat3";
+				    must "24 - 4 = number('20')";
+        			default "25";
+        			config true;
+        			mandatory false;
+        			description "dsc";
+        			reference "none";
+      			}
+    		}
+
+			leaf leaf4 {
+				type int64 {
+					range "1000 .. 50000" {
+						error-message
+						"Special e        
+					}
+					.";
+				}
+			}
+    	}
+
+      }
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue777.yang b/tests/fuzz/corpus/lys_parse_mem/issue777.yang
new file mode 100644
index 0000000..21bb436
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue777.yang
@@ -0,0 +1,16 @@
+module m0d0 {
+    prefix a0c;
+    namespace ¢0000000000000000000000";
+
+    list list0 {
+key "key1";
+    unique "0n000";
+        leaf key1 {
+            type string;
+        }
+
+        leaf uniq0 {
+            type string;
+        }
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue780.yang b/tests/fuzz/corpus/lys_parse_mem/issue780.yang
new file mode 100644
index 0000000..2e9ba1e
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue780.yang
Binary files differ
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue788.yang b/tests/fuzz/corpus/lys_parse_mem/issue788.yang
new file mode 100644
index 0000000..9804c02
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue788.yang
@@ -0,0 +1,8 @@
+module d00000000 {
+	namespace "n";
+    prefix d;
+    leaf l1 {
+        type string;
+        when "/l0{k='when']";
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue789.yang b/tests/fuzz/corpus/lys_parse_mem/issue789.yang
new file mode 100644
index 0000000..1ec8ae7
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue789.yang
@@ -0,0 +1,10 @@
+module m {
+	prefix p;
+	namespace "n";
+ 	grouping g {
+	}
+
+	grouping s {
+		uses g;
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue791.yang b/tests/fuzz/corpus/lys_parse_mem/issue791.yang
new file mode 100644
index 0000000..d2568b7
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue791.yang
@@ -0,0 +1,3 @@
+module m {
+	include ""
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue791_2.yang b/tests/fuzz/corpus/lys_parse_mem/issue791_2.yang
new file mode 100644
index 0000000..8303f87
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue791_2.yang
@@ -0,0 +1,13 @@
+module m {
+    namespace "n";
+    prefix p;
+
+    container c {
+        leaf trg-bits {
+			type bits {
+				bit b1;
+				bit "";
+			}
+		}
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue795.yang b/tests/fuzz/corpus/lys_parse_mem/issue795.yang
new file mode 100644
index 0000000..f33e321
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue795.yang
@@ -0,0 +1,7 @@
+module m {
+	prefix p;
+	namespace "n";
+	list l {
+		must "";
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue804.yang b/tests/fuzz/corpus/lys_parse_mem/issue804.yang
new file mode 100644
index 0000000..1578b7e
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue804.yang
@@ -0,0 +1,7 @@
+module m {
+	prefix p;
+	namespace n;
+	list l {
+		if-feature 0(;
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue805.yang b/tests/fuzz/corpus/lys_parse_mem/issue805.yang
new file mode 100644
index 0000000..45ee5f1
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue805.yang
@@ -0,0 +1,7 @@
+module d{
+	namespace n;
+	prefix p;
+	list l {
+		when "";
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue807.yang b/tests/fuzz/corpus/lys_parse_mem/issue807.yang
new file mode 100644
index 0000000..0493a79
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue807.yang
@@ -0,0 +1,9 @@
+module d{
+	namespace "";
+	prefix d;
+	leaf f {
+		type string;
+		must "0e";
+		default "";
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue826.yang b/tests/fuzz/corpus/lys_parse_mem/issue826.yang
new file mode 100644
index 0000000..ffd0778
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue826.yang
@@ -0,0 +1,12 @@
+module mod6 {
+
+    prefix abc;
+    namespace "ht/www.example.c;
+-versin~ 1.1   containerLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLre lse;
+if-feature DDDDDDDDDDDD,DDLLLLLLLLLTL)ont1 { //x" {}  augment "/auDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr-----------------------------------------------------------------------------------------------------------------------------------------------LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLau" {
+	container c { 		uses egroup1 {
+ if-feature "feat2"; if-feature lse;
+
+} }
+  }
+}
\ No newline at end of file
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue827.yang b/tests/fuzz/corpus/lys_parse_mem/issue827.yang
new file mode 100644
index 0000000..c5637f9
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue827.yang
@@ -0,0 +1,10 @@
+module ee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eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeod {
+	yang-version 1.1;
+  	namespace "urn:all";
+  	prefix p;
+
+  	container cond1 { 	}
+
+  	grouping group1 {
+    }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue872.yang b/tests/fuzz/corpus/lys_parse_mem/issue872.yang
new file mode 100644
index 0000000..27decd5
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue872.yang
@@ -0,0 +1,7 @@
+module d{
+namespace "";prefix d;
+	leaf f{
+		type w0iiiiiiiiiiiiiiiiiiiiiiiiiiiii0000;
+		default "";
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue874.yang b/tests/fuzz/corpus/lys_parse_mem/issue874.yang
new file mode 100644
index 0000000..c42be25
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue874.yang
@@ -0,0 +1,28 @@
+module o00 {   prefix c;   namespace "00t000000w0000p00000
+00n000e0000n00000
+
+   0cANG m0dule de0in0s an 'exten0ion' s0atemns
+     for defining 0etadat0 an0Copyri0ht (0) 2016 IE00 T0uct and th0 persons identifi4.0 of the IETF Tru0t0s Le0a0 P0ovi0i00s
+     Relatin0 t0 IE0F D0cu0e0 of RFC 7     (/tru0te0.ietf0org0license-info0.
+
+     Th0s ve00io0 of thi0 YA0G mod0le i0 pa't of RFC 78    (http:/0www-e0itor.!rg/info/0fc0902); see the 0FC i000lf
+     f0r fodule, i  ";revision 2016-08-05{
+description
+"Initial revision.";
+reference "RFC 7952: Defining and 0sin0 0etada0a with YANG";
+}
+
+extension annotation{
+argument name;
+description "This extension allows f0r defietadat0tadata an00tation0 in
+       YAN0 modules.  0he 0sion.";
+reference "RFC 7952: Defining and 0sin0 0etada0a with YANG";
+}
+
+extension annotation{
+argument name;
+description "   YAN0 modules.  0he 0sion.";
+reference "RFC 7952: Defining and 0sin0 0etada0a with YANG";
+}
+
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue970.yang b/tests/fuzz/corpus/lys_parse_mem/issue970.yang
new file mode 100644
index 0000000..18df054
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue970.yang
@@ -0,0 +1,18 @@
+module p{
+	namespace "";
+	prefix p;
+
+	container ports{
+		list port {
+			key name;
+			leaf name{	
+				type string;}	
+		}	
+	}	
+	augment "/ports/port" {
+		when "0</*=0";
+		leaf i {
+			type int32;
+		}
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue973.yang b/tests/fuzz/corpus/lys_parse_mem/issue973.yang
new file mode 100644
index 0000000..9da8f00
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue973.yang
@@ -0,0 +1,10 @@
+module p{
+	namespace "";
+	prefix p;
+
+	leaf mgmt-interface {
+		type leafref {
+			path "";
+		}
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue975.yang b/tests/fuzz/corpus/lys_parse_mem/issue975.yang
new file mode 100644
index 0000000..d0a91a0
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue975.yang
@@ -0,0 +1,28 @@
+module example-ietf-interfaces {
+  yang-version 1.1;
+
+  namespace "urn:ietf:params:xml:ns:yang:example-ietf-interfaces";
+
+  prefix if;
+  import ietf-yang-types {
+    prefix yang;
+  }
+
+  container interfaces-state {
+    config false;
+    list interface {
+      key "name";
+      leaf name {
+        type string;
+      }
+      container statistics {
+        leaf in-broadcast-pkts {
+          when "derived-from(if:type, 'ianaifp:multicast')" {
+          }
+
+          type yang:counter64;
+        }
+      }
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue976_a.yang b/tests/fuzz/corpus/lys_parse_mem/issue976_a.yang
new file mode 100644
index 0000000..670a13b
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue976_a.yang
@@ -0,0 +1,12 @@
+module a{
+  yang-version 1.1;
+  namespace "ns1";
+  prefix a;
+
+  import issue976_b{
+    prefix acl;
+  }
+
+  augment "/acl:acls/acl:acl/acl:aces/acl:ace/acl:matches" {
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue976_b.yang b/tests/fuzz/corpus/lys_parse_mem/issue976_b.yang
new file mode 100644
index 0000000..ee0b621
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue976_b.yang
@@ -0,0 +1,32 @@
+module issue976_b {
+  yang-version 1.1;
+  namespace "ns2";
+  prefix acl;
+
+  container acls {
+    list acl {
+      key "name";
+      leaf name {
+        type string;
+      }
+      container aces {
+        list ace {
+          key "name";
+          leaf name {
+            type string {
+              length "1..64";
+            }
+          }
+          container matches {
+            leaf egress-interface {
+              type if:interface-ref;
+            }
+            leaf ingress-interface {
+              type if:interface-ref;
+            }
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue979_a.yang b/tests/fuzz/corpus/lys_parse_mem/issue979_a.yang
new file mode 100644
index 0000000..1fe355c
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue979_a.yang
@@ -0,0 +1,41 @@
+module a {
+  namespace "a";
+  prefix a;
+
+  import b{
+    prefix b;
+  }
+
+  typedef HexOffset {
+    type string;
+  }
+
+  grouping group {
+    container action {
+      config false;
+      container register {
+        config false;
+        list location {
+          key "location";
+          config false;
+          leaf location {
+            type string;
+          }
+          b:action "write" {
+            input {
+              leaf reg-addr {
+                type HexOffset;
+                mandatory true;
+              }
+            }
+            output {
+              leaf result {
+                type string;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/issue979_b.yang b/tests/fuzz/corpus/lys_parse_mem/issue979_b.yang
new file mode 100644
index 0000000..7f5f43e
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/issue979_b.yang
@@ -0,0 +1,13 @@
+module b {
+  namespace "b";
+  prefix b;
+
+  extension action {
+    argument name {
+      b:arg-type {
+        type b:identifier;
+      }
+    }
+  }
+}
+
diff --git a/tests/fuzz/corpus/lys_parse_mem/pull958.yang b/tests/fuzz/corpus/lys_parse_mem/pull958.yang
new file mode 100644
index 0000000..9df4b76
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/pull958.yang
@@ -0,0 +1,8 @@
+module m {
+	prefix p;
+	namespace "
+
+	list l {
+		must "";
+	}
+}
diff --git a/tests/fuzz/corpus/lys_parse_mem/pull960.yang b/tests/fuzz/corpus/lys_parse_mem/pull960.yang
new file mode 100644
index 0000000..2356615
--- /dev/null
+++ b/tests/fuzz/corpus/lys_parse_mem/pull960.yang
@@ -0,0 +1,9 @@
+module d{
+	namespace "";
+	prefix d;
+	leaf f {
+		type string;
+		must ":e";
+		default "";
+	}
+}
diff --git a/tests/fuzz/fuzz_regression_test.c b/tests/fuzz/fuzz_regression_test.c
new file mode 100644
index 0000000..53b2ec8
--- /dev/null
+++ b/tests/fuzz/fuzz_regression_test.c
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include<fcntl.h>
+
+int main(int argc, char **argv) 
+{
+	DIR *d;
+	struct dirent *dir;
+	pid_t p = 0;
+	int input_fd = 0;
+	int status = 0;
+	int rc = 0;
+	struct stat path_stat;
+	int i = 0;
+
+	if (argc != 3) {
+		fprintf(stderr, "invalid number of arguments. Call like this ./fuzz_regression_test fuzz_harness corpus_dir\n");
+		return EXIT_FAILURE;
+	}
+
+	d = opendir(argv[2]);
+	if (!d) {
+		fprintf(stderr, "error opening dir %s\n", argv[2]);
+		return EXIT_FAILURE;
+	}
+
+	while ((dir = readdir(d)) != NULL) {
+		stat(dir->d_name, &path_stat);
+		if (!S_ISREG(path_stat.st_mode)) {
+			continue;
+		}
+
+		p = fork();
+		if (p == -1) {
+			fprintf(stderr, "fork failed\n");
+			return EXIT_FAILURE;
+		} else if (p == 0) {
+			input_fd = open(dir->d_name, O_RDONLY);
+			if (input_fd == -1) {
+				fprintf(stderr, "error opening input file %s\n", dir->d_name);
+				return EXIT_FAILURE;
+			}
+			
+			dup2(input_fd, STDIN_FILENO);
+			execl(argv[1], argv[1], NULL);
+			return EXIT_SUCCESS;
+		}
+
+		rc = waitpid(p, &status, 0);
+		if (rc == -1) {
+			fprintf(stderr, "waitpid failed\n");
+			return EXIT_FAILURE;
+		}
+
+		if (!WIFEXITED(status)) {
+			fprintf(stderr, "test %s - %s failed\n", argv[1], argv[2]);
+			return EXIT_FAILURE;
+		}
+
+		printf("test %s - %s successful\n", argv[1], dir->d_name);
+	}
+
+	return EXIT_SUCCESS;
+}