bitstruct 8.22.1__tar.gz → 8.22.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {bitstruct-8.22.1/src/bitstruct.egg-info → bitstruct-8.22.2}/PKG-INFO +1 -1
  2. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct/__init__.py +1 -1
  3. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct/c.c +7 -0
  4. {bitstruct-8.22.1 → bitstruct-8.22.2/src/bitstruct.egg-info}/PKG-INFO +1 -1
  5. {bitstruct-8.22.1 → bitstruct-8.22.2}/tests/test_c.py +6 -0
  6. {bitstruct-8.22.1 → bitstruct-8.22.2}/LICENSE +0 -0
  7. {bitstruct-8.22.1 → bitstruct-8.22.2}/MANIFEST.in +0 -0
  8. {bitstruct-8.22.1 → bitstruct-8.22.2}/Makefile +0 -0
  9. {bitstruct-8.22.1 → bitstruct-8.22.2}/README.rst +0 -0
  10. {bitstruct-8.22.1 → bitstruct-8.22.2}/docs/Makefile +0 -0
  11. {bitstruct-8.22.1 → bitstruct-8.22.2}/docs/conf.py +0 -0
  12. {bitstruct-8.22.1 → bitstruct-8.22.2}/docs/index.rst +0 -0
  13. {bitstruct-8.22.1 → bitstruct-8.22.2}/docs/make.bat +0 -0
  14. {bitstruct-8.22.1 → bitstruct-8.22.2}/pyproject.toml +0 -0
  15. {bitstruct-8.22.1 → bitstruct-8.22.2}/setup.cfg +0 -0
  16. {bitstruct-8.22.1 → bitstruct-8.22.2}/setup.py +0 -0
  17. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct/bitstream.c +0 -0
  18. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct/bitstream.h +0 -0
  19. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct.egg-info/SOURCES.txt +0 -0
  20. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct.egg-info/dependency_links.txt +0 -0
  21. {bitstruct-8.22.1 → bitstruct-8.22.2}/src/bitstruct.egg-info/top_level.txt +0 -0
  22. {bitstruct-8.22.1 → bitstruct-8.22.2}/tests/__init__.py +0 -0
  23. {bitstruct-8.22.1 → bitstruct-8.22.2}/tests/test_bitstruct.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitstruct
3
- Version: 8.22.1
3
+ Version: 8.22.2
4
4
  Summary: This module performs conversions between Python values and C bit field structs represented as Python byte strings.
5
5
  Author: Ilya Petukhov
6
6
  Author-email: Erik Moqvist <erik.moqvist@gmail.com>
@@ -1,4 +1,4 @@
1
- __version__ = '8.22.1'
1
+ __version__ = '8.22.2'
2
2
 
3
3
  import binascii
4
4
  import re
@@ -925,6 +925,13 @@ static struct info_t *parse_format(PyObject *format_obj_p)
925
925
  return (NULL);
926
926
  }
927
927
 
928
+ if (number_of_bits > (INT_MAX - info_p->number_of_bits)) {
929
+ PyErr_SetString(PyExc_ValueError, "Format too long.");
930
+ PyMem_RawFree(info_p);
931
+
932
+ return (NULL);
933
+ }
934
+
928
935
  info_p->number_of_bits += number_of_bits;
929
936
  }
930
937
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitstruct
3
- Version: 8.22.1
3
+ Version: 8.22.2
4
4
  Summary: This module performs conversions between Python values and C bit field structs represented as Python byte strings.
5
5
  Author: Ilya Petukhov
6
6
  Author-email: Erik Moqvist <erik.moqvist@gmail.com>
@@ -253,6 +253,12 @@ class CTest(unittest.TestCase):
253
253
  size = calcsize('b1s6u7u9P1t8')
254
254
  self.assertEqual(size, 32)
255
255
 
256
+ # The total number of bits does not fit in an int.
257
+ with self.assertRaises(ValueError) as cm:
258
+ calcsize('p214748369' * 20)
259
+
260
+ self.assertEqual(str(cm.exception), 'Format too long.')
261
+
256
262
  def test_compiled_calcsize(self):
257
263
  """Calculate size.
258
264
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes