quickcheck says: "a-s--a" is not a legal key filename

Found this in failed armhf build log, where quickcheck found a way to break
prop_idempotent_key_decode. The "s" indicates size, but since nothing comes
after it, that's not valid. When encoding the resulting key, no size was
present, so it encoded to "a--a".

Also, "a-sX--a" is not legal, since X is not a number. Not found by
quickcheck.
This commit is contained in:
Joey Hess 2014-03-04 23:58:43 -04:00
parent b9d6e70019
commit e8ab82390e

View file

@ -78,8 +78,12 @@ file2key s
findfields _ v = v
addbackend k v = Just k { keyBackendName = v }
addfield 's' k v = Just k { keySize = readish v }
addfield 'm' k v = Just k { keyMtime = readish v }
addfield 's' k v = do
sz <- readish v
return $ k { keySize = Just sz }
addfield 'm' k v = do
mtime <- readish v
return $ k { keyMtime = Just mtime }
addfield _ _ _ = Nothing
instance Arbitrary Key where