@@ -3483,7 +3483,14 @@ decode0 table byte =
34833483 let !t = table `unsafePeekElemOff` fromIntegral byte
34843484 !codep' = (0xff `shiftR` (fromIntegral t)) .&. fromIntegral byte
34853485 !state' = table `unsafePeekElemOff` (256 + fromIntegral t)
3486− in (Tuple' state' codep')
3486+ in assert ((byte > 0x7f || error showByte)
3487+ && (state' /= 0 || error (showByte ++ showState state')))
3488+ (Tuple' state' codep')
3489+
3490+ where
3491+
3492+ showByte = "decode0: Invalid byte: " ++ show byte
3493+ showState st = " state: " ++ show st ++ " table: " ++ show table
34873494
34883495-- When the state is not 0
34893496{-# INLINE decode1 #-}