Commit Graph

44 Commits

Author SHA1 Message Date
Phil Turnbull 5877d9a30d
Prevent out-of-bounds read when deserializing
We first serialize the total number of tags, then serialize each individual
tag. If we don't have enough space to serialize a particular tag we stop
serializing any remaining tags.

However, this causes an out-of-bounds read when deserializing because there are
less tags than expected. Just bail when there are too many tags to serialize.
2018-08-07 14:40:33 -04:00
Phil Turnbull e541c9b64b
Avoid integer cast issues when deserializing tags
`buffer` contains signed chars, so if a tag length is greater than 128 then it
is treated as a negative value when deserializing. The negative signed char is
then implicitly cast to a large unsigned integer. Explicitly cast the values to
signed chars

Co-authored-by: Rahul Zhade <zhade3@github.com>
2018-08-07 14:18:24 -04:00
Phil Turnbull 2eda6161d6
Avoid integer truncation when serializing tag lengths
A tag longer than 255 characters will be incorrectly serialized.

Co-authored-by: Rahul Zhade <zhade3@github.com>
2018-08-07 14:18:24 -04:00
Phil Turnbull 3e586b10fc
Fixed error where empty vector was being popped from
Co-authored-by: Rahul Zhade <zhade3@github.com>
2018-08-07 14:18:18 -04:00
Max Brunsfeld fa5426a735 0.13.1 2018-07-18 13:19:13 -07:00
Max Brunsfeld 083e6b9fbd Fix off-by-one error in scanner buffer size limit 2018-07-18 13:19:03 -07:00
Max Brunsfeld e74795bc0d Use unsigned, not size_t, for serializing tag stack size 2018-07-18 11:32:04 -07:00
Max Brunsfeld 70533673a2 Use std::memcpy from <cstring> 2018-07-18 11:30:49 -07:00
Max Brunsfeld 64d7888308 0.13.0 2018-07-18 11:24:54 -07:00
Max Brunsfeld b04bf7b507 ⬆️ tree-sitter-cli (new ABI version) 2018-07-18 11:24:49 -07:00
Max Brunsfeld c9b0de0410 Fix memory errors for deeply-nested HTML 2018-07-18 11:24:15 -07:00
Max Brunsfeld 7a8417f1d9 0.12.1 2018-07-06 16:30:24 -07:00
Max Brunsfeld 5d8c68c137 Fix range of script tag content 2018-06-28 20:32:27 -07:00
Max Brunsfeld 2ffed65538 0.12.0 2018-06-18 11:56:25 -07:00
Max Brunsfeld 6222cd9127 Use NULL instead of nullptr 2018-06-18 10:17:38 -07:00
Max Brunsfeld d746362d0f 0.1.3 2018-06-18 10:09:18 -07:00
Max Brunsfeld 3ba95dbf3e Represent tag name map as a std::map
This doesn't seem to affect performance, and unordered_map requires
C++11.
2018-06-18 10:05:44 -07:00
Max Brunsfeld 331b0a4b00 Include tag stack size when serializing external scanner 2018-06-18 10:04:59 -07:00
Ashi Krishnan bd235b794b
Merge pull request #1 from tree-sitter/c++99
Make the scanner compile without C++11 features
2018-06-15 19:40:41 -04:00
Max Brunsfeld 2a3ef3b7b1 Build tag map with a static method instead of an initializer list 2018-06-15 16:09:46 -07:00
Max Brunsfeld 8e6d71bd54 Don't use fancy enum features 2018-06-15 16:09:46 -07:00
Max Brunsfeld 3fce691fae Use a regular constructor instead of aggregate initialization 2018-06-15 16:09:46 -07:00
Max Brunsfeld 8afd99e35e Use explicit types instead of auto 2018-06-15 16:09:45 -07:00
Max Brunsfeld 6923b13394 Remove one range-based for loop 2018-06-15 16:09:45 -07:00
Max Brunsfeld 5def8f2a86 Use string methods for copying bytes, not loops 2018-06-15 16:09:45 -07:00
Max Brunsfeld 43f84098b8 Fix crash on unexpected closing tag after error 2018-06-15 15:36:30 -07:00
Max Brunsfeld 9cccc08b84
Count scanner but not parser in GH language stats 2018-06-13 09:34:38 -07:00
Max Brunsfeld 1211095e73 0.1.2 2018-06-12 14:12:56 -07:00
Max Brunsfeld 95b8b772d5 Handle void tags at EOF 2018-06-12 14:06:16 -07:00
Max Brunsfeld d257db6f66 Add custom tags test 2018-06-12 14:03:51 -07:00
Max Brunsfeld 32a48343b3 0.1.1 2018-06-12 13:54:23 -07:00
Max Brunsfeld b4153cd431 Avoid designated initializer syntax for static array
Clang seems to allow this, but it's only for C, not C++
2018-06-12 13:49:54 -07:00
Max Brunsfeld 14ed7c8147 0.1.0 2018-06-12 12:20:18 -07:00
Max Brunsfeld 5f2a122de7 Parse tag names as separate tokens 2018-06-12 12:20:13 -07:00
Max Brunsfeld 4d11a75675 Ignore package-lock.json 2018-06-12 10:52:43 -07:00
Max Brunsfeld 7cfe147792 Handle elements with optional end tags (li, p, etc)
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-12 10:51:03 -07:00
Max Brunsfeld 43e4826bb7 Use toupper, iswspace from cwctype header 2018-06-11 17:22:50 -07:00
Max Brunsfeld d41a8ca50b ⬆️ tree-sitter-cli 2018-06-11 17:22:50 -07:00
Max Brunsfeld 0bd6cd558b Add README, CI config files 2018-06-11 17:22:50 -07:00
Max Brunsfeld 21b5fad6f0 Add raw text elements and doctypes
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-11 16:59:44 -07:00
Max Brunsfeld d9a504136e Add package.json
Co-Authored-By: Ashi Krishan <queerviolet@github.com>
2018-06-11 16:59:44 -07:00
Max Brunsfeld e56df0fc7f Add comments, allow slashes in unquoted attribute values
Co-Authored-By: Ashi Krishan <queerviolet@github.com>
2018-06-11 16:59:44 -07:00
Max Brunsfeld 6ee8f55084 Start tracking element nesting in external scanner
Co-Authored-By: Ashi Krishan <queerviolet@github.com>
2018-06-11 16:59:44 -07:00
Max Brunsfeld e74d96c27b Initial commit
Co-Authored-By: Ashi Krishan <queerviolet@github.com>
2018-06-11 16:59:22 -07:00