fix bug when heredoc_identifier length exceeds CHAR_MAX
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <wctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace {
|
||||
|
||||
using std::vector;
|
||||
@@ -49,6 +51,9 @@ public:
|
||||
if (size + 2 + it->heredoc_identifier.size() >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) {
|
||||
return 0;
|
||||
}
|
||||
if (it->heredoc_identifier.size() > CHAR_MAX) {
|
||||
return 0;
|
||||
}
|
||||
buf[size++] = it->type;
|
||||
buf[size++] = it->heredoc_identifier.size();
|
||||
it->heredoc_identifier.copy(&buf[size], it->heredoc_identifier.size());
|
||||
|
||||
Reference in New Issue
Block a user