First commit of disabling indefinite length strings
diff --git a/QCBOR.xcodeproj/project.pbxproj b/QCBOR.xcodeproj/project.pbxproj
index 1983591..9733eb7 100644
--- a/QCBOR.xcodeproj/project.pbxproj
+++ b/QCBOR.xcodeproj/project.pbxproj
@@ -56,6 +56,19 @@
 		E776E091214AE07500E67947 /* qcbor_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08E214AE07500E67947 /* qcbor_decode.c */; };
 		E776E097214AE0C700E67947 /* cmd_line_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E096214AE0C700E67947 /* cmd_line_main.c */; };
 		E7864766252CE63100A0C11B /* qcbor_err_to_str.c in Sources */ = {isa = PBXBuildFile; fileRef = E7864765252CE63100A0C11B /* qcbor_err_to_str.c */; };
+		E7FDBF04256C969D007138A8 /* qcbor_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08C214AE07400E67947 /* qcbor_encode.c */; };
+		E7FDBF05256C969D007138A8 /* ieee754.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57582161CA690080D658 /* ieee754.c */; };
+		E7FDBF06256C969D007138A8 /* qcbor_err_to_str.c in Sources */ = {isa = PBXBuildFile; fileRef = E7864765252CE63100A0C11B /* qcbor_err_to_str.c */; };
+		E7FDBF07256C969D007138A8 /* half_to_double_from_rfc7049.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575D2161CA7C0080D658 /* half_to_double_from_rfc7049.c */; };
+		E7FDBF08256C969D007138A8 /* run_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57632161F8F70080D658 /* run_tests.c */; };
+		E7FDBF09256C969D007138A8 /* qcbor_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08E214AE07500E67947 /* qcbor_decode.c */; };
+		E7FDBF0A256C969D007138A8 /* float_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575A2161CA7C0080D658 /* float_tests.c */; };
+		E7FDBF0B256C969D007138A8 /* qcbor_decode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB5216CE6CA00BA646B /* qcbor_decode_tests.c */; };
+		E7FDBF0C256C969D007138A8 /* UsefulBuf.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08D214AE07500E67947 /* UsefulBuf.c */; };
+		E7FDBF0D256C969D007138A8 /* qcbor_encode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB8216DC7AD00BA646B /* qcbor_encode_tests.c */; };
+		E7FDBF0E256C969D007138A8 /* cmd_line_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E096214AE0C700E67947 /* cmd_line_main.c */; };
+		E7FDBF0F256C969D007138A8 /* example.c in Sources */ = {isa = PBXBuildFile; fileRef = E743D0E124AC516D0017899F /* example.c */; };
+		E7FDBF10256C969D007138A8 /* UsefulBuf_Tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEBC216DE31700BA646B /* UsefulBuf_Tests.c */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -95,6 +108,15 @@
 			);
 			runOnlyForDeploymentPostprocessing = 1;
 		};
+		E7FDBF12256C969D007138A8 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
@@ -134,6 +156,7 @@
 		E78C91DF240C90C100F4CECE /* qcbor_common.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_common.h; path = inc/qcbor/qcbor_common.h; sourceTree = "<group>"; tabWidth = 3; };
 		E78C91E0240C90C100F4CECE /* qcbor_private.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_private.h; path = inc/qcbor/qcbor_private.h; sourceTree = "<group>"; tabWidth = 3; };
 		E78C91E1240C90C100F4CECE /* qcbor_encode.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_encode.h; path = inc/qcbor/qcbor_encode.h; sourceTree = "<group>"; tabWidth = 3; };
+		E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = QCBOR_Disable_Indef; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -165,6 +188,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		E7FDBF11256C969D007138A8 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
@@ -199,6 +229,7 @@
 				E772022723B52C02006E966E /* QCBOR_Disable_Exp_Mantissa */,
 				E743D11B24DD4EF50017899F /* QCBOR_Disable_HW_Float */,
 				E743D13124DE05CC0017899F /* QCBOR_Disable_Preferred_Float */,
+				E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -321,6 +352,23 @@
 			productReference = E776E07C214ADF7F00E67947 /* QCBOR */;
 			productType = "com.apple.product-type.tool";
 		};
+		E7FDBF02256C969D007138A8 /* QCBOR_Disable_Indef */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = E7FDBF13256C969D007138A8 /* Build configuration list for PBXNativeTarget "QCBOR_Disable_Indef" */;
+			buildPhases = (
+				E7FDBF03256C969D007138A8 /* Sources */,
+				E7FDBF11256C969D007138A8 /* Frameworks */,
+				E7FDBF12256C969D007138A8 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = QCBOR_Disable_Indef;
+			productName = QCBOR;
+			productReference = E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */;
+			productType = "com.apple.product-type.tool";
+		};
 /* End PBXNativeTarget section */
 
 /* Begin PBXProject section */
@@ -352,6 +400,7 @@
 				E772021523B52C02006E966E /* QCBOR_Disable_Exp_Mantissa */,
 				E743D10924DD4EF50017899F /* QCBOR_Disable_HW_Float */,
 				E743D11E24DE05CC0017899F /* QCBOR_Disable_Preferred_Float */,
+				E7FDBF02256C969D007138A8 /* QCBOR_Disable_Indef */,
 			);
 		};
 /* End PBXProject section */
@@ -434,6 +483,26 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		E7FDBF03256C969D007138A8 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E7FDBF04256C969D007138A8 /* qcbor_encode.c in Sources */,
+				E7FDBF05256C969D007138A8 /* ieee754.c in Sources */,
+				E7FDBF06256C969D007138A8 /* qcbor_err_to_str.c in Sources */,
+				E7FDBF07256C969D007138A8 /* half_to_double_from_rfc7049.c in Sources */,
+				E7FDBF08256C969D007138A8 /* run_tests.c in Sources */,
+				E7FDBF09256C969D007138A8 /* qcbor_decode.c in Sources */,
+				E7FDBF0A256C969D007138A8 /* float_tests.c in Sources */,
+				E7FDBF0B256C969D007138A8 /* qcbor_decode_tests.c in Sources */,
+				E7FDBF0C256C969D007138A8 /* UsefulBuf.c in Sources */,
+				E7FDBF0D256C969D007138A8 /* qcbor_encode_tests.c in Sources */,
+				E7FDBF0E256C969D007138A8 /* cmd_line_main.c in Sources */,
+				E7FDBF0F256C969D007138A8 /* example.c in Sources */,
+				E7FDBF10256C969D007138A8 /* UsefulBuf_Tests.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXSourcesBuildPhase section */
 
 /* Begin XCBuildConfiguration section */
@@ -670,6 +739,35 @@
 			};
 			name = Release;
 		};
+		E7FDBF14256C969D007138A8 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
+				CODE_SIGN_STYLE = Automatic;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS;
+				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_WARN_PEDANTIC = YES;
+				"HEADER_SEARCH_PATHS[arch=*]" = inc;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		E7FDBF15256C969D007138A8 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
+				CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
+				CODE_SIGN_STYLE = Automatic;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_WARN_PEDANTIC = YES;
+				"HEADER_SEARCH_PATHS[arch=*]" = inc;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
@@ -718,6 +816,15 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		E7FDBF13256C969D007138A8 /* Build configuration list for PBXNativeTarget "QCBOR_Disable_Indef" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				E7FDBF14256C969D007138A8 /* Debug */,
+				E7FDBF15256C969D007138A8 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 /* End XCConfigurationList section */
 	};
 	rootObject = E776E074214ADF7F00E67947 /* Project object */;
diff --git a/inc/qcbor/qcbor_common.h b/inc/qcbor/qcbor_common.h
index 1c76a8a..f872917 100644
--- a/inc/qcbor/qcbor_common.h
+++ b/inc/qcbor/qcbor_common.h
@@ -466,7 +466,11 @@
        infinity or -infinity was encountered in encoded CBOR. Usually
        this because conversion of the float-point value was being
        attempted. */
-    QCBOR_ERR_FLOAT_EXCEPTION = 42,
+   QCBOR_ERR_FLOAT_EXCEPTION = 42,
+
+
+   /** Indefinite length string handling is disabled and there is an indefinite length string in the input CBOR. */
+   QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED = 43,
 
    /* This is stored in uint8_t; never add values > 255 */
 } QCBORError;
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 7b41ff3..452cd17 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -478,7 +478,7 @@
 }
 
 
-
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
 /*===========================================================================
    QCBORStringAllocate -- STRING ALLOCATOR INVOCATION
 
@@ -516,7 +516,7 @@
       (pMe->pfAllocator)(pMe->pAllocateCxt, NULL, 0);
    }
 }
-
+#endif
 
 
 /*===========================================================================
@@ -544,6 +544,8 @@
 }
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+
 /*
  Public function, see header file
  */
@@ -556,6 +558,7 @@
    pMe->StringAllocator.pAllocateCxt  = pAllocateContext;
    pMe->bStringAllocateAll            = bAllStrings;
 }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
 
 
 /*
@@ -843,7 +846,6 @@
  @retval QCBOR_ERR_STRING_TOO_LONG
  */
 static inline QCBORError DecodeBytes(const QCORInternalAllocator *pAllocator,
-                                     int nMajorType,
                                      uint64_t uStrLen,
                                      UsefulInputBuf *pUInBuf,
                                      QCBORItem *pDecodedItem)
@@ -868,6 +870,7 @@
       goto Done;
    }
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
    if(pAllocator) {
       // We are asked to use string allocator to make a copy
       UsefulBuf NewMem = StringAllocator_Allocate(pAllocator, (size_t)uStrLen);
@@ -877,23 +880,33 @@
       }
       pDecodedItem->val.string = UsefulBuf_Copy(NewMem, Bytes);
       pDecodedItem->uDataAlloc = 1;
-   } else {
-      // Normal case with no string allocator
-      pDecodedItem->val.string = Bytes;
+      goto Done;
    }
-   const bool bIsBstr = (nMajorType == CBOR_MAJOR_TYPE_BYTE_STRING);
-   // Cast because ternary operator causes promotion to integer
-   pDecodedItem->uDataType = (uint8_t)(bIsBstr ? QCBOR_TYPE_BYTE_STRING
-                                               : QCBOR_TYPE_TEXT_STRING);
+#else
+   (void)pAllocator;
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
+   // Normal case with no string allocator
+   pDecodedItem->val.string = Bytes;
 
 Done:
    return nReturn;
 }
 
 
+/* Map the CBOR major types for strings to the QCBOR types for strngs */
+static inline uint8_t MapStringMajorTypes(int nCBORMajorType)
+{
+   #if CBOR_MAJOR_TYPE_BYTE_STRING + 4 != QCBOR_TYPE_BYTE_STRING
+   #error QCBOR_TYPE_BYTE_STRING no lined up with major type
+   #endif
 
+   #if CBOR_MAJOR_TYPE_TEXT_STRING + 4 != QCBOR_TYPE_TEXT_STRING
+   #error QCBOR_TYPE_TEXT_STRING no lined up with major type
+   #endif
 
-
+   return (uint8_t)(nCBORMajorType + 4);
+}
 
 
 // Make sure the constants align as this is assumed by
@@ -969,13 +982,11 @@
 
       case CBOR_MAJOR_TYPE_BYTE_STRING: // Major type 2
       case CBOR_MAJOR_TYPE_TEXT_STRING: // Major type 3
+         pDecodedItem->uDataType = (uint8_t)MapStringMajorTypes(nMajorType);
          if(nAdditionalInfo == LEN_IS_INDEFINITE) {
-            const bool bIsBstr = (nMajorType == CBOR_MAJOR_TYPE_BYTE_STRING);
-            pDecodedItem->uDataType = (uint8_t)(bIsBstr ? QCBOR_TYPE_BYTE_STRING
-                                                        : QCBOR_TYPE_TEXT_STRING);
             pDecodedItem->val.string = (UsefulBufC){NULL, SIZE_MAX};
          } else {
-            nReturn = DecodeBytes(pAllocator, nMajorType, uNumber, pUInBuf, pDecodedItem);
+            nReturn = DecodeBytes(pAllocator, uNumber, pUInBuf, pDecodedItem);
          }
          break;
 
@@ -994,7 +1005,7 @@
          }
          // C preproc #if above makes sure constants for major types align
          // DecodeTypeAndNumber never returns a major type > 7 so cast is safe
-         pDecodedItem->uDataType  = (uint8_t)nMajorType;
+         pDecodedItem->uDataType = (uint8_t)nMajorType;
          break;
 
       case CBOR_MAJOR_TYPE_OPTIONAL: // Major type 6, optional prepended tags
@@ -1049,7 +1060,7 @@
  @retval QCBOR_ERR_INDEFINITE_STRING_CHUNK
  */
 static inline QCBORError
-GetNext_FullItem(QCBORDecodeContext *me, QCBORItem *pDecodedItem)
+GetNext_FullItem(QCBORDecodeContext *pMe, QCBORItem *pDecodedItem)
 {
    // Stack usage; int/ptr 2 UsefulBuf 2 QCBORItem  -- 96
 
@@ -1057,22 +1068,25 @@
    // GetNext_Item() when option is set to allocate for *every* string.
    // Second use here is to allocate space to coallese indefinite
    // length string items into one.
-   const QCORInternalAllocator *pAllocator = me->StringAllocator.pfAllocator ?
-                                                      &(me->StringAllocator) :
-                                                      NULL;
+   const QCORInternalAllocator *pAllocatorForGetNext = NULL;
+
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+   const QCORInternalAllocator *pAllocator = NULL;
+
+   if(pMe->StringAllocator.pfAllocator) {
+      pAllocator = &(pMe->StringAllocator);
+      if(pMe->bStringAllocateAll ) {
+         pAllocatorForGetNext = pAllocator;
+      }
+   }
+#endif
 
    QCBORError nReturn;
-   nReturn = GetNext_Item(&(me->InBuf),
-                          pDecodedItem,
-                          me->bStringAllocateAll ? pAllocator: NULL);
+   nReturn = GetNext_Item(&(pMe->InBuf), pDecodedItem, pAllocatorForGetNext);
    if(nReturn) {
       goto Done;
    }
 
-   // To reduce code size by removing support for indefinite length strings, the
-   // code in this function from here down can be eliminated. Run tests, except
-   // indefinite length string tests, to be sure all is OK if this is removed.
-
    // Only do indefinite length processing on strings
    const uint8_t uStringType = pDecodedItem->uDataType;
    if(uStringType!= QCBOR_TYPE_BYTE_STRING && uStringType != QCBOR_TYPE_TEXT_STRING) {
@@ -1084,6 +1098,7 @@
       goto Done; // length is not indefinite, so no work to do here
    }
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
    // Can't do indefinite length strings without a string allocator
    if(pAllocator == NULL) {
       nReturn = QCBOR_ERR_NO_STRING_ALLOCATOR;
@@ -1098,7 +1113,7 @@
       QCBORItem StringChunkItem;
       // NULL string allocator passed here. Do not need to allocate
       // chunks even if bStringAllocateAll is set.
-      nReturn = GetNext_Item(&(me->InBuf), &StringChunkItem, NULL);
+      nReturn = GetNext_Item(&(pMe->InBuf), &StringChunkItem, NULL);
       if(nReturn) {
          break;  // Error getting the next chunk
       }
@@ -1114,13 +1129,14 @@
       // Match data type of chunk to type at beginning.
       // Also catches error of other non-string types that don't belong.
       // Also catches indefinite length strings inside indefinite length strings
+      // TODO: what is SIZE_MAX here?
       if(StringChunkItem.uDataType != uStringType ||
          StringChunkItem.val.string.len == SIZE_MAX) {
          nReturn = QCBOR_ERR_INDEFINITE_STRING_CHUNK;
          break;
       }
 
-      // Alloc new buffer or expand previously allocated buffer so it can fit
+      // Alloc new buffer or expand previously allocated buffer so it can fit.
       // The first time throurgh FullString.ptr is NULL and this is
       // equivalent to StringAllocator_Allocate()
       UsefulBuf NewMem = StringAllocator_Reallocate(pAllocator,
@@ -1141,11 +1157,15 @@
       // Getting the item failed, clean up the allocated memory
       StringAllocator_Free(pAllocator, UNCONST_POINTER(FullString.ptr));
    }
+#else
+   nReturn = QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED;
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
 
 Done:
    return nReturn;
 }
 
+
 static uint64_t ConvertTag(const QCBORDecodeContext *me, uint16_t uTagVal) {
    if(uTagVal <= QCBOR_LAST_UNMAPPED_TAG) {
       return uTagVal;
@@ -2206,9 +2226,11 @@
    }
 
 Done:
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
    // Call the destructor for the string allocator if there is one.
    // Always called, even if there are errors; always have to clean up
    StringAllocator_Destruct(&(me->StringAllocator));
+#endif
 
    return uReturn;
 }
@@ -2281,6 +2303,7 @@
 
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
 
 /* ===========================================================================
    MemPool -- BUILT-IN SIMPLE STRING ALLOCATOR
@@ -2461,6 +2484,7 @@
 
    return QCBOR_SUCCESS;
 }
+#endif
 
 
 
diff --git a/test/not_well_formed_cbor.h b/test/not_well_formed_cbor.h
index e905cd1..efe2c33 100644
--- a/test/not_well_formed_cbor.h
+++ b/test/not_well_formed_cbor.h
@@ -28,6 +28,7 @@
 
     // Indefinite length strings must be closed off
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
     // An indefinite length byte string not closed off
     {(uint8_t[]){0x5f, 0x41, 0x00}, 3},
     // An indefinite length text string not closed off
@@ -58,6 +59,8 @@
     // indefinite length text string with indefinite string inside
     {(uint8_t[]){0x7f, 0x7f, 0x61, 0x00, 0xff, 0xff}, 6},
 
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
     // Definte length maps and arrays must be closed by having the
     // right number of items
 
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 6ee22fd..9b41371 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -1644,8 +1644,10 @@
       // string test cases
       QCBORDecodeContext DCtx;
       QCBORDecode_Init(&DCtx, Input, QCBOR_DECODE_MODE_NORMAL);
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
       UsefulBuf_MAKE_STACK_UB(Pool, 100);
       QCBORDecode_SetMemPool(&DCtx, Pool, 0);
+#endif
 
       // Loop getting items until no more to get
       QCBORError uCBORError;
@@ -1680,13 +1682,19 @@
       // Set up the decoding context including a memory pool so that
       // indefinite length items can be checked
       QCBORDecodeContext DCtx;
+      QCBORError nCBORError;
+
       QCBORDecode_Init(&DCtx, pF->Input, QCBOR_DECODE_MODE_NORMAL);
+
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
       UsefulBuf_MAKE_STACK_UB(Pool, 100);
 
-      QCBORError nCBORError = QCBORDecode_SetMemPool(&DCtx, Pool, 0);
+      nCBORError = QCBORDecode_SetMemPool(&DCtx, Pool, 0);
       if(nCBORError) {
          return -9;
       }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
 
       // Iterate until there is an error of some sort error
       QCBORItem Item;
@@ -1716,6 +1724,7 @@
    // Most of this is copied from not_well_formed.h. Here the error code
    // returned is also checked.
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
    // Indefinite length strings must be closed off
    // An indefinite length byte string not closed off
    { {(uint8_t[]){0x5f, 0x41, 0x00}, 3}, QCBOR_ERR_HIT_END },
@@ -1745,6 +1754,36 @@
    // indefinite length text string with indefinite string inside
    { {(uint8_t[]){0x7f, 0x7f, 0x61, 0x00, 0xff, 0xff}, 6}, QCBOR_ERR_INDEFINITE_STRING_CHUNK},
 
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
+   { {(uint8_t[]){0x5f, 0x41, 0x00}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // An indefinite length text string not closed off
+   { {(uint8_t[]){0x7f, 0x61, 0x00}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+
+
+   // All the chunks in an indefinite length string must be of the type of
+   // indefinite length string
+   // indefinite length byte string with text string chunk
+   { {(uint8_t[]){0x5f, 0x61, 0x00, 0xff}, 4}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length text string with a byte string chunk
+   { {(uint8_t[]){0x7f, 0x41, 0x00, 0xff}, 4}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length byte string with an positive integer chunk
+   { {(uint8_t[]){0x5f, 0x00, 0xff}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length byte string with an negative integer chunk
+   { {(uint8_t[]){0x5f, 0x21, 0xff}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length byte string with an array chunk
+   { {(uint8_t[]){0x5f, 0x80, 0xff}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length byte string with an map chunk
+   { {(uint8_t[]){0x5f, 0xa0, 0xff}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length byte string with tagged integer chunk
+   { {(uint8_t[]){0x5f, 0xc0, 0x00, 0xff}, 4}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   // indefinite length byte string with an simple type chunk
+   { {(uint8_t[]){0x5f, 0xe0, 0xff}, 3}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED },
+   { {(uint8_t[]){0x5f, 0x5f, 0x41, 0x00, 0xff, 0xff}, 6}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED},
+   // indefinite length text string with indefinite string inside
+   { {(uint8_t[]){0x7f, 0x7f, 0x61, 0x00, 0xff, 0xff}, 6}, QCBOR_ERR_INDEF_LEN_STRINGS_DISABLED},
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
 
    // Definte length maps and arrays must be closed by having the right number of items
    // A definte length array that is supposed to have 1 item, but has none
@@ -3632,7 +3671,6 @@
    return 0;
 }
 
-
 // [1, [2, 3]]
 static const uint8_t spIndefiniteArray[]     = {0x9f, 0x01, 0x82, 0x02, 0x03, 0xff};
 // No closing break
@@ -3653,13 +3691,10 @@
     UsefulBufC IndefLen = UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spIndefiniteArray);
 
     // Decode it and see if it is OK
-    UsefulBuf_MAKE_STACK_UB(MemPool, 150);
     QCBORDecodeContext DC;
     QCBORItem Item;
     QCBORDecode_Init(&DC, IndefLen, QCBOR_DECODE_MODE_NORMAL);
 
-    QCBORDecode_SetMemPool(&DC, MemPool, false);
-
     QCBORDecode_GetNext(&DC, &Item);
 
     if(Item.uDataType != QCBOR_TYPE_ARRAY ||
@@ -3705,8 +3740,6 @@
 
    QCBORDecode_Init(&DC, IndefLen, QCBOR_DECODE_MODE_NORMAL);
 
-   QCBORDecode_SetMemPool(&DC, MemPool, false);
-
    nResult = QCBORDecode_GetNext(&DC, &Item);
    if(nResult || Item.uDataType != QCBOR_TYPE_ARRAY) {
       return -7;
@@ -3723,8 +3756,6 @@
 
    QCBORDecode_Init(&DC, IndefLen, QCBOR_DECODE_MODE_NORMAL);
 
-   QCBORDecode_SetMemPool(&DC, MemPool, false);
-
    nResult = QCBORDecode_GetNext(&DC, &Item);
    if(nResult || Item.uDataType != QCBOR_TYPE_ARRAY) {
       return -9;
@@ -3751,8 +3782,6 @@
 
    QCBORDecode_Init(&DC, IndefLen, QCBOR_DECODE_MODE_NORMAL);
 
-   QCBORDecode_SetMemPool(&DC, MemPool, false);
-
    nResult = QCBORDecode_GetNext(&DC, &Item);
    if(nResult || Item.uDataType != QCBOR_TYPE_ARRAY) {
       return -13;
@@ -3774,8 +3803,6 @@
 
    QCBORDecode_Init(&DC, IndefLen, QCBOR_DECODE_MODE_NORMAL);
 
-   QCBORDecode_SetMemPool(&DC, MemPool, false);
-
    nResult = QCBORDecode_GetNext(&DC, &Item);
    if(nResult || Item.uDataType != QCBOR_TYPE_ARRAY) {
       return -15;
@@ -3796,8 +3823,6 @@
 
    QCBORDecode_Init(&DC, IndefLen, QCBOR_DECODE_MODE_NORMAL);
 
-   QCBORDecode_SetMemPool(&DC, MemPool, false);
-
    nResult = QCBORDecode_GetNext(&DC, &Item);
    if(nResult || Item.uDataType != QCBOR_TYPE_ARRAY) {
       return -18;
@@ -3812,6 +3837,8 @@
 }
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+
 static const uint8_t spIndefiniteLenString[] = {
    0x81, // Array of length one
    0x7f, // text string marked with indefinite length
@@ -4196,7 +4223,6 @@
 }
 
 
-
 int32_t MemPoolTest(void)
 {
    // Set up the decoder with a tiny bit of CBOR to parse because
@@ -4327,6 +4353,8 @@
 
    return 0;
 }
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+
 
 #ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
 
@@ -5411,6 +5439,7 @@
       -18446744073709551617.0,
       QCBOR_SUCCESS
    },
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
    {
       "Positive bignum 0x01020304 indefinite length string",
       {(uint8_t[]){0xC2, 0x5f, 0x42, 0x01, 0x02, 0x41, 0x03, 0x41, 0x04, 0xff}, 10},
@@ -5421,6 +5450,7 @@
       16909060.0,
       QCBOR_SUCCESS
    },
+#endif
    {
       "Decimal Fraction with neg bignum [9223372036854775807, -4759477275222530853137]",
       {(uint8_t[]){0xC4, 0x82, 0x1B, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -5807,6 +5837,21 @@
 
 
 
+
+static int32_t SetUpDecoder(QCBORDecodeContext *DCtx, UsefulBufC CBOR, UsefulBuf Pool)
+{
+   QCBORDecode_Init(DCtx, CBOR, QCBOR_DECODE_MODE_NORMAL);
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+   if(QCBORDecode_SetMemPool(DCtx, Pool, 0)) {
+      return 1;
+   }
+#else /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+   (void)Pool;
+#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+   return 0;
+}
+
+
 int32_t IntegerConvertTest()
 {
    const int nNumTests = sizeof(NumberConversions)/sizeof(struct NumberConversion);
@@ -5820,10 +5865,8 @@
       UsefulBuf_MAKE_STACK_UB(Pool, 100);
 
       /* ----- test conversion to int64_t ------ */
-      QCBORDecode_Init(&DCtx, pF->CBOR, QCBOR_DECODE_MODE_NORMAL);
-      QCBORError nCBORError = QCBORDecode_SetMemPool(&DCtx, Pool, 0);
-      if(nCBORError) {
-         return (int32_t)(1000+nIndex);
+      if(SetUpDecoder(&DCtx, pF->CBOR, Pool)) {
+         return (int32_t)(3333+nIndex);
       }
 
       int64_t nInt;
@@ -5836,11 +5879,10 @@
       }
 
       /* ----- test conversion to uint64_t ------ */
-      QCBORDecode_Init(&DCtx, pF->CBOR, QCBOR_DECODE_MODE_NORMAL);
-      nCBORError = QCBORDecode_SetMemPool(&DCtx, Pool, 0);
-      if(nCBORError) {
-         return (int32_t)(1000+nIndex);
+      if(SetUpDecoder(&DCtx, pF->CBOR, Pool)) {
+         return (int32_t)(3333+nIndex);
       }
+
       uint64_t uInt;
       QCBORDecode_GetUInt64ConvertAll(&DCtx, 0xffff, &uInt);
       if(QCBORDecode_GetError(&DCtx) != pF->uErrorUint64) {
@@ -5851,10 +5893,8 @@
       }
 
       /* ----- test conversion to double ------ */
-      QCBORDecode_Init(&DCtx, pF->CBOR, QCBOR_DECODE_MODE_NORMAL);
-      nCBORError = QCBORDecode_SetMemPool(&DCtx, Pool, 0);
-      if(nCBORError) {
-         return (int32_t)(1000+nIndex);
+       if(SetUpDecoder(&DCtx, pF->CBOR, Pool)) {
+         return (int32_t)(3333+nIndex);
       }
 #ifndef QCBOR_DISABLE_FLOAT_HW_USE
       double d;
@@ -6685,6 +6725,8 @@
 }
 
 
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+
 static const uint8_t spMapWithIndefLenStrings[] = {
    0xbf,
       0x7f, 0x61, 'l', 0x64, 'a', 'b', 'e', 'l' , 0x61, '1', 0xff,
@@ -6756,7 +6798,7 @@
 
    return 0;
 }
-
+#endif /* #ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
 
 
 
diff --git a/test/run_tests.c b/test/run_tests.c
index aa42013..b2dc46c 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -63,7 +63,6 @@
     TEST_ENTRY(EmptyMapsAndArraysTest),
     TEST_ENTRY(NotWellFormedTests),
     TEST_ENTRY(ParseMapAsArrayTest),
-    TEST_ENTRY(AllocAllStringsTest),
     TEST_ENTRY(IndefiniteLengthNestTest),
     TEST_ENTRY(NestedMapTestIndefLen),
     TEST_ENTRY(ParseSimpleTest),
@@ -95,8 +94,13 @@
     TEST_ENTRY(ParseDeepArrayTest),
     TEST_ENTRY(SimpleArrayTest),
     TEST_ENTRY(IntegerValuesParseTest),
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS
+    TEST_ENTRY(AllocAllStringsTest),
     TEST_ENTRY(MemPoolTest),
     TEST_ENTRY(IndefiniteLengthStringTest),
+    TEST_ENTRY(SpiffyIndefiniteLengthStringsTests),
+    TEST_ENTRY(SetUpAllocatorTest),
+#endif /* #ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
 #ifndef QCBOR_DISABLE_PREFERRED_FLOAT
     TEST_ENTRY(HalfPrecisionDecodeBasicTests),
     TEST_ENTRY(DoubleAsSmallestTest),
@@ -112,7 +116,6 @@
     TEST_ENTRY_DISABLED(BigComprehensiveInputTest),
     TEST_ENTRY_DISABLED(TooLargeInputTest),
     TEST_ENTRY(EncodeErrorTests),
-    TEST_ENTRY(SetUpAllocatorTest),
     TEST_ENTRY(SimpleValuesIndefiniteLengthTest1),
     TEST_ENTRY(EncodeLengthThirtyoneTest),
     TEST_ENTRY(CBORSequenceDecodeTests),
@@ -124,7 +127,6 @@
     TEST_ENTRY(ExponentAndMantissaDecodeTests),
     TEST_ENTRY(ExponentAndMantissaDecodeFailTests),
     TEST_ENTRY(ExponentAndMantissaEncodeTests),
-    TEST_ENTRY(SpiffyIndefiniteLengthStringsTests),
 #endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
 };