<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/basics/struct1.py, branch 5.3.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.3.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.3.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2017-09-01T01:11:09+00:00</updated>
<entry>
<title>py/modstruct: Check and prevent buffer-write overflow in struct packing.</title>
<updated>2017-09-01T01:11:09+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-09-01T01:11:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=2daacc5ceef7e36ac3c88b8946088b6b3513993b'/>
<id>urn:sha1:2daacc5ceef7e36ac3c88b8946088b6b3513993b</id>
<content type='text'>
Prior to this patch, the size of the buffer given to pack_into() was checked
for being too small by using the count of the arguments, not their actual
size.  For example, a format spec of '4I' would only check that there was 4
bytes available, not 16; and 'I' would check for 1 byte, not 4.

The pack() function is ok because its buffer is created to be exactly the
correct size.

The fix in this patch calculates the total size of the format spec at the
start of pack_into() and verifies that the buffer is large enough.  This
adds some computational overhead, to iterate through the whole format spec.
The alternative is to check during the packing, but that requires extra
code to handle alignment, and the check is anyway not needed for pack().
So to maintain minimal code size the check is done using struct_calcsize.
</content>
</entry>
<entry>
<title>py/modstruct: Check and prevent buffer-read overflow in struct unpacking</title>
<updated>2017-09-01T00:53:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-09-01T00:53:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=79d5acbd01fed21e1c8e46b06690072375de0bfe'/>
<id>urn:sha1:79d5acbd01fed21e1c8e46b06690072375de0bfe</id>
<content type='text'>
Prior to this patch, the size of the buffer given to unpack/unpack_from was
checked for being too small by using the count of the arguments, not their
actual size.  For example, a format spec of '4I' would only check that
there was 4 bytes available, not 16; and 'I' would check for 1 byte, not 4.

This bug is fixed in this patch by calculating the total size of the format
spec at the start of the unpacking function.  This function anyway needs to
calculate the number of items at the start, so calculating the total size
can be done at the same time.
</content>
</entry>
<entry>
<title>tests/basics: Convert "sys.exit()" to "raise SystemExit".</title>
<updated>2017-06-10T17:03:01+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-06-10T17:03:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a2803b74f48849cb3a11fb492fee891044ecc1f4'/>
<id>urn:sha1:a2803b74f48849cb3a11fb492fee891044ecc1f4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests/basic: Split tests into working with small ints and not working.</title>
<updated>2017-03-03T21:13:27+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-03-03T21:13:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=3ab6aa3a6d0506e805caa19369bef279c1c789b4'/>
<id>urn:sha1:3ab6aa3a6d0506e805caa19369bef279c1c789b4</id>
<content type='text'>
Tests which don't work with small ints are suffixed with _intbig.py. Some
of these may still work with long long ints and need to be reclassified
later.
</content>
</entry>
<entry>
<title>tests/basics: Add tests to improve coverage of binary.c.</title>
<updated>2016-12-28T05:11:54+00:00</updated>
<author>
<name>Rami Ali</name>
<email>flowergrass@users.noreply.github.com</email>
</author>
<published>2016-12-28T04:29:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=65574f817a949fea2316c335da866c1b8d20f1fb'/>
<id>urn:sha1:65574f817a949fea2316c335da866c1b8d20f1fb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests/struct*: Make skippable.</title>
<updated>2016-12-19T16:41:12+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-12-19T16:40:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=91359c86900ea664a8ad4fefad22b630bd714e2d'/>
<id>urn:sha1:91359c86900ea664a8ad4fefad22b630bd714e2d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests: Improve coverage of struct with test for non-compliant behaviour.</title>
<updated>2016-10-07T01:57:25+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-10-07T01:57:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=82af4d6749072d01195da647f54b79c80f1ad731'/>
<id>urn:sha1:82af4d6749072d01195da647f54b79c80f1ad731</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests/struct1: Test "l" specifier to improve coverage.</title>
<updated>2016-09-19T14:01:02+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-09-19T13:59:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b85bcd671c5dced62fa00f2e3c0c5541b0d16593'/>
<id>urn:sha1:b85bcd671c5dced62fa00f2e3c0c5541b0d16593</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests/struct1: Add testcase for an unknown type char.</title>
<updated>2016-05-14T12:54:09+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-05-14T12:54:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=719f8c044a9d30a8d9f4356af1310f18e82e5b67'/>
<id>urn:sha1:719f8c044a9d30a8d9f4356af1310f18e82e5b67</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Add ustruct.pack_into and unpack_from</title>
<updated>2016-01-19T12:25:28+00:00</updated>
<author>
<name>Dave Hylands</name>
<email>dhylands@gmail.com</email>
</author>
<published>2015-12-24T03:11:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a17755ee8ba2982505d349e0f06acdabe943d33e'/>
<id>urn:sha1:a17755ee8ba2982505d349e0f06acdabe943d33e</id>
<content type='text'>
</content>
</entry>
</feed>
