diff --git a/libasterix.cabal b/libasterix.cabal
--- a/libasterix.cabal
+++ b/libasterix.cabal
@@ -1,6 +1,6 @@
 cabal-version:      3.0
 name:               libasterix
-version:            0.11.0
+version:            0.11.1
 synopsis:           Asterix data processing library
 description:
     This library provides features to process asterix data format, including
diff --git a/src/Asterix/Base.hs b/src/Asterix/Base.hs
--- a/src/Asterix/Base.hs
+++ b/src/Asterix/Base.hs
@@ -840,9 +840,10 @@
 parseRawDatablock :: ByteString -> Either ParsingError (RawDatablock, ByteString)
 parseRawDatablock bs = do
     let n = BS.length bs
-    when (n < 3) $ Left "overflow"
+    when (n < 3) $ Left "overflow datablock header"
     let m = fromIntegral (BS.index bs 1) * 256 + fromIntegral (BS.index bs 2)
-    when (m > n) $ Left "overflow"
+    when (m < 3) $ Left "unexpected length"
+    when (m > n) $ Left "overflow datablock records"
     pure (RawDatablock $ BS.take m bs, BS.drop m bs)
 
 -- | Parse many RawDatablocks.
diff --git a/test/TestRawDatablock.hs b/test/TestRawDatablock.hs
--- a/test/TestRawDatablock.hs
+++ b/test/TestRawDatablock.hs
@@ -8,6 +8,7 @@
 import           Data.Word
 import           Test.Tasty
 import           Test.Tasty.HUnit
+import           Test.Tasty.QuickCheck
 
 import           Asterix.Base
 import           Asterix.BitString
@@ -33,6 +34,9 @@
     , "02000402" -- cat2
     ]
 
+allZeros :: String
+allZeros = "00000000000000000000"
+
 datagramIn :: ByteString
 datagramIn = fromJust $ unhexlify $ mconcat samples
 
@@ -47,6 +51,13 @@
     , testCase "reverse" $ assertEqual "sample"
         (fromJust $ unhexlify $ mconcat $ reverse samples)
         (builderToByteStringSlow $ reverseDatablocks datagramIn)
+    , testCase "all zeros" $ assertEqual "sample"
+        True (isLeft $ parseRawDatablocks $ fromJust $ unhexlify allZeros)
+    , testProperty "random input" $ withMaxSuccess 10_000 $ \(lst :: [Word8]) ->
+        let bs = BS.pack lst
+            result = parseRawDatablocks bs
+        -- this is always true, but we want the expression to terminate
+        in (isLeft result || isRight result)
     ]
   where
     cat1 = take 2 samples
