Issue #21868: Prevent turtle crash due to invalid undo buffer size.
diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py
index 6a90715..75673a4 100644
--- a/Lib/lib-tk/turtle.py
+++ b/Lib/lib-tk/turtle.py
@@ -2499,7 +2499,7 @@
         Example (for a Turtle instance named turtle):
         >>> turtle.setundobuffer(42)
         """
-        if size is None:
+        if size is None or size <= 0:
             self.undobuffer = None
         else:
             self.undobuffer = Tbuffer(size)
diff --git a/Misc/ACKS b/Misc/ACKS
index 27be949..2dc0e77 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -235,6 +235,7 @@
 Albert Chin-A-Young
 Adal Chiriliuc
 Matt Chisholm
+Lita Cho
 Anders Chrigström
 Tom Christiansen
 Renee Chu
diff --git a/Misc/NEWS b/Misc/NEWS
index 9ba62e8..0181a46 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,9 @@
 - Issue #22017: Correct reference counting errror in the initialization of the
   _warnings module.
 
+- Issue #21868: Prevent turtle crash when undo buffer set to a value less
+  than one.
+
 - Issue #21044: tarfile.open() now handles fileobj with an integer 'name'
   attribute.  Based on patch by Martin Panter.