]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
function < integer will never return false
authorBenedikt Bauer <benedikt@xenzilla.de>
Tue, 23 May 2017 18:25:37 +0000 (20:25 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 13 Jun 2017 15:28:50 +0000 (17:28 +0200)
Sorry, if this is a strange Python thing I don't understand, but to me it looks like this has at best undefined behaviour and will at worst be completely useless because len < nlen+dlen will never be able to return false. (len is a function and needs a parameter to return any useful numeric information)

lib/py/tvh/htsmsg.py

index 853988a9ae7f7c8e60e0d587866f043a57167f90..9c925b3cc42f85df0d198bc7f6f5e3fd971ec770 100644 (file)
@@ -169,7 +169,7 @@ def deserialize0(data, typ=HMF_MAP):
         dlen = bin2int(data[2:6])
         data = data[6:]
 
-        if len < nlen + dlen: raise Exception('not enough data')
+        if len(data) < nlen + dlen: raise Exception('not enough data')
 
         name = data[:nlen]
         data = data[nlen:]