<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/modstruct.c, branch 6.0.0-alpha.2</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0-alpha.2</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0-alpha.2'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-07-06T18:16:25+00:00</updated>
<entry>
<title>Add license to some obvious files.</title>
<updated>2020-07-06T18:16:25+00:00</updated>
<author>
<name>Diego Elio Pettenò</name>
<email>flameeyes@flameeyes.com</email>
</author>
<published>2020-06-03T22:40:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=34b4993d63a6b576f29d624385c681f679b4124c'/>
<id>urn:sha1:34b4993d63a6b576f29d624385c681f679b4124c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Improve struct compatibility with CPython</title>
<updated>2019-01-20T20:12:34+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2019-01-20T20:10:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7a09af73ec7f4a11a1404dff6276e09072d06983'/>
<id>urn:sha1:7a09af73ec7f4a11a1404dff6276e09072d06983</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Support internationalisation.</title>
<updated>2018-08-07T21:58:57+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2018-07-31T23:53:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=933add6cd833bb6ba6682ad2b6eb478871415ff5'/>
<id>urn:sha1:933add6cd833bb6ba6682ad2b6eb478871415ff5</id>
<content type='text'>
</content>
</entry>
<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>py/modstruct: In struct.pack, stop converting if there are no args left.</title>
<updated>2017-09-01T00:10:51+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-09-01T00:10:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=793d826d9df67c3f544505beda63ca36d8dfa1c4'/>
<id>urn:sha1:793d826d9df67c3f544505beda63ca36d8dfa1c4</id>
<content type='text'>
This patch makes a repeat counter behave the same as repeating the
typecode, when there are not enough args.  For example:
struct.pack('2I', 1) now behave the same as struct.pack('II', 1).
</content>
</entry>
<entry>
<title>all: Use the name MicroPython consistently in comments</title>
<updated>2017-07-31T08:35:40+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-30T07:22:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=55f33240f3d7051d4213629e92437a36f1fac50e'/>
<id>urn:sha1:55f33240f3d7051d4213629e92437a36f1fac50e</id>
<content type='text'>
There were several different spellings of MicroPython present in comments,
when there should be only one.
</content>
</entry>
<entry>
<title>py/binary: mp_binary_get_size: Raise error on unsupported typecodes.</title>
<updated>2017-01-17T19:53:06+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-01-17T19:50:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=af9046193148084f008501434e4c9f49fedc053f'/>
<id>urn:sha1:af9046193148084f008501434e4c9f49fedc053f</id>
<content type='text'>
Previouly, we had errors checked in callers, which led to duplicate code
or missing checks in some places.
</content>
</entry>
<entry>
<title>py/modstruct: Remove unreachable code, and add comment about CPy diff.</title>
<updated>2016-10-07T01:54:14+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-10-07T01:54:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dffa383b062b0dd788abed0af242b66bde910e6b'/>
<id>urn:sha1:dffa383b062b0dd788abed0af242b66bde910e6b</id>
<content type='text'>
The deleted code is unreachable because calcsize_items guarantees that
num_items corresponds to how many items there are in fmt to unpack.
</content>
</entry>
<entry>
<title>all: Remove 'name' member from mp_obj_module_t struct.</title>
<updated>2016-09-21T14:23:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-09-21T00:52:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=93c4a6a3f70e389b466fbc7a4f1ad2e1df87c93f'/>
<id>urn:sha1:93c4a6a3f70e389b466fbc7a4f1ad2e1df87c93f</id>
<content type='text'>
One can instead lookup __name__ in the modules dict to get the value.
</content>
</entry>
</feed>
