Skip to content

Commit

Permalink
Make sure that indexes in the autogenerated locale info do not exceed…
Browse files Browse the repository at this point in the history
… 16bit range.

Reviewed-By: TrustMe
  • Loading branch information
Denis Dzyubenko committed Jun 8, 2009
1 parent 4336436 commit 9736f27
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion util/local_database/qlocalexml2cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,17 @@ def append(self, s):
return self.hash[s]

lst = map(lambda x: hex(ord(x)), s)
token = StringDataToken(len(self.data), len(lst))
index = len(self.data)
if index >= 65535:
print "\n\n\n#error Data index is too big!"
sys.stderr.write ("\n\n\nERROR: index exceeds the uint16 range! index = %d\n" % index)
sys.exit(1)
size = len(lst)
if size >= 65535:
print "\n\n\n#error Data is too big!"
sys.stderr.write ("\n\n\nERROR: data size exceeds the uint16 range! size = %d\n" % size)
sys.exit(1)
token = StringDataToken(index, size)
self.hash[s] = token
self.data += lst
return token
Expand Down

0 comments on commit 9736f27

Please sign in to comment.