circuitpython/py
Damien George ede8a0235b py/vstr: Raise a RuntimeError if fixed vstr buffer overflows.
Current users of fixed vstr buffers (building file paths) assume that there
is no overflow and do not check for overflow after building the vstr.  This
has the potential to lead to NULL pointer dereferences
(when vstr_null_terminated_str returns NULL because it can't allocate RAM
for the terminating byte) and stat'ing and loading invalid path names (due
to the path being truncated).  The safest and simplest thing to do in these
cases is just raise an exception if a write goes beyond the end of a fixed
vstr buffer, which is what this patch does.  It also simplifies the vstr
code.
2017-09-21 20:29:41 +10:00
..
argcheck.c all: Raise exceptions via mp_raise_XXX 2017-08-13 22:52:33 +10:00
asmarm.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmarm.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmbase.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmbase.h py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmthumb.c py/asmthumb: Use existing macro to properly clear the D-cache. 2017-08-23 11:32:27 +10:00
asmthumb.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmx64.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmx64.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmx86.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmx86.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
asmxtensa.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmxtensa.h py/asmxtensa.h: Explicitly cast args to 32-bits so left-shift is legal. 2017-02-08 10:48:51 +11:00
bc0.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
bc.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
bc.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
binary.c py/binary.c: Fix bug when packing big-endian 'Q' values. 2017-08-15 11:33:43 +10:00
binary.h py/binary: Change internal bytearray typecode from 0 to 1. 2017-08-17 16:19:35 +10:00
builtin.h py/builtinhelp: Change signature of help text var from pointer to array. 2017-09-12 16:03:52 +10:00
builtinevex.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
builtinhelp.c py/builtinhelp: Change signature of help text var from pointer to array. 2017-09-12 16:03:52 +10:00
builtinimport.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
compile.c py/compile: Remove unused pn_colon code when compiling func params. 2017-08-21 22:00:34 +10:00
compile.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
emit.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
emitbc.c py/emitbc: Remove stray semicolon in outer scope. 2017-09-13 20:36:06 +10:00
emitcommon.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
emitglue.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
emitglue.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
emitinlinethumb.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
emitinlinextensa.c py/emitinline: Move common code for end of final pass to compiler. 2016-12-09 21:23:17 +11:00
emitnative.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
formatfloat.c py/formatfloat: Don't post-increment variable that won't be used again. 2017-08-21 22:04:23 +10:00
formatfloat.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
frozenmod.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
frozenmod.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
gc.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
gc.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
grammar.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
lexer.c all: Raise exceptions via mp_raise_XXX 2017-08-13 22:52:33 +10:00
lexer.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
makeqstrdata.py py/makeqstrdata.py: Compute the qstr hash from bytes, not characters. 2016-09-02 14:32:47 +10:00
makeqstrdefs.py py/makeqstrdefs.py: Make script run correctly with Python 2.6. 2017-06-09 13:42:13 +10:00
makeversionhdr.py py/makeversionhdr.py: Update to parse new release line in docs/conf.py. 2017-07-04 22:37:41 +10:00
malloc.c py: Make m_malloc_fail() have void return type, since it doesn't return. 2017-08-31 17:00:14 +10:00
map.c py/map: Remove unused new/free functions. 2017-08-31 16:46:13 +10:00
misc.h py: Make m_malloc_fail() have void return type, since it doesn't return. 2017-08-31 17:00:14 +10:00
mkenv.mk various: Spelling fixes 2017-05-29 11:36:05 +03:00
mkrules.mk all: Update Makefiles and others to build with new ports/ dir layout. 2017-09-06 14:09:13 +10:00
modarray.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
modbuiltins.c py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
modcmath.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modcollections.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
modgc.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modio.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
modmath.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modmicropython.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
modstruct.c py/modstruct: Check and prevent buffer-write overflow in struct packing. 2017-09-01 11:11:09 +10:00
modsys.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modthread.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
moduerrno.c py/moduerrno: Make list of errno codes configurable. 2017-02-22 12:58:11 +11:00
mpconfig.h py/mpconfig.h: Add note that using computed gotos in VM is not C99. 2017-09-18 23:53:33 +10:00
mperrno.h py/mperrno: Allow mperrno.h to be correctly included before other hdrs. 2017-07-24 18:41:24 +10:00
mphal.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpprint.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpprint.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpstate.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpstate.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpthread.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mpz.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpz.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
nativeglue.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
nlr.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
nlrsetjmp.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
nlrthumb.c py/nlrthumb: Get working again on standard Thumb arch (ie not Thumb2). 2017-09-01 15:25:29 +10:00
nlrx64.c py/nlrx86,x64: Replace #define of defined() with portable macro usage. 2017-08-29 12:52:18 +10:00
nlrx86.c py/nlrx86: Fix building for Android/x86. 2017-09-12 08:55:14 +03:00
nlrxtensa.c py/nlrxtensa: Convert from assembler to C file with inline asm. 2017-03-06 17:13:16 +11:00
obj.c py/obj: Fix comparison of float/complex NaN with itself. 2017-09-04 14:16:27 +10:00
obj.h py/obj: Remove declaration for mp_obj_new_none(), it's never defined. 2017-09-04 23:35:46 +10:00
objarray.c all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objarray.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objattrtuple.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objbool.c all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objboundmeth.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objcell.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objclosure.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objcomplex.c py/{objfloat,objcomplex}: Optimise MP_UNARY_OP_ABS by reusing variables. 2017-09-18 14:31:03 +10:00
objdict.c all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objenumerate.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objexcept.c py/objexcept: Prevent infinite recursion when allocating exceptions. 2017-09-21 15:24:57 +10:00
objexcept.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objfilter.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objfloat.c py/{objfloat,objcomplex}: Optimise MP_UNARY_OP_ABS by reusing variables. 2017-09-18 14:31:03 +10:00
objfun.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
objfun.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objgenerator.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objgenerator.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objgetitemiter.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objint_longlong.c py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
objint_mpz.c py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
objint.c py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
objint.h py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
objlist.c py/objlist: Properly implement comparison with incompatible types. 2017-09-07 00:10:10 +03:00
objlist.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objmap.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objmodule.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objmodule.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objnamedtuple.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objnone.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objobject.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objpolyiter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objproperty.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objrange.c all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objreversed.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objset.c all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objsingleton.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objslice.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objstr.c py/objstr: strip: Don't strip "\0" by default. 2017-09-19 21:21:12 +03:00
objstr.h all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objstringio.c py/objstringio: Fix regression with handling SEEK_SET. 2017-08-20 22:02:41 +03:00
objstringio.h py/objstringio: If created from immutable object, follow copy on write policy. 2017-06-09 17:33:01 +03:00
objstrunicode.c all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objtuple.c py/objtuple: Properly implement comparison with incompatible types. 2017-09-06 00:23:41 +03:00
objtuple.h all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate 2017-08-29 13:16:30 +10:00
objtype.c py/runtime: Implement dispatch for "reverse op" special methods. 2017-09-10 17:05:57 +03:00
objtype.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objzip.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
opmethods.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parse.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parse.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenum.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenum.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenumbase.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenumbase.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
persistentcode.c py/persistentcode: Allow to compile with complex numbers disabled. 2017-06-08 00:28:28 +10:00
persistentcode.h py: Factor out persistent-code reader into separate files. 2016-11-16 18:13:50 +11:00
py.mk esp8266: Set DEFPSIZE=1024, MINCACHE=3 for "btree" module. 2017-09-10 13:54:00 +03:00
qstr.c py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. 2017-08-15 11:53:36 +10:00
qstr.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
qstrdefs.h py/qstrdefs: Remove unused qstrs. 2017-09-01 15:22:25 +10:00
reader.c all: Don't include system errno.h when it's not needed. 2017-07-24 18:43:14 +10:00
reader.h py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
repl.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
repl.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
ringbuf.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
runtime0.h py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
runtime_utils.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
runtime.c py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
runtime.h py/runtime.h: Change empty mp_warning macro so var-args are non empty. 2017-09-13 20:33:55 +10:00
scheduler.c py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
scope.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
scope.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
sequence.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
showbc.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
smallint.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
smallint.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
stackctrl.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
stackctrl.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
stream.c py/stream: Remove unnecessary checks for NULL return from vstr_add_len. 2017-09-21 18:22:55 +10:00
stream.h py/objstringio: Fix regression with handling SEEK_SET. 2017-08-20 22:02:41 +03:00
unicode.c py/objstr: Add check for valid UTF-8 when making a str from bytes. 2017-09-06 16:43:09 +10:00
unicode.h py/objstr: Add check for valid UTF-8 when making a str from bytes. 2017-09-06 16:43:09 +10:00
vm.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
vmentrytable.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
vstr.c py/vstr: Raise a RuntimeError if fixed vstr buffer overflows. 2017-09-21 20:29:41 +10:00
warning.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00