Skip to content

Commit 1153778

Browse files
Dong Xielemire
authored andcommitted
fix a bug in copy constructor of ParsedJson::iterator. (simdjson#146)
1 parent 49332d3 commit 1153778

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

singleheader/simdjson.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ ParsedJson::iterator::iterator(const iterator &o):
16181618
current_val(o.current_val), depthindex(nullptr) {
16191619
depthindex = new scopeindex_t[pj.depthcapacity];
16201620
if(depthindex != nullptr) {
1621-
memcpy(o.depthindex, depthindex, pj.depthcapacity * sizeof(depthindex[0]));
1621+
memcpy(depthindex, o.depthindex, pj.depthcapacity * sizeof(depthindex[0]));
16221622
} else {
16231623
tape_length = 0;
16241624
}

src/parsedjsoniterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ParsedJson::iterator::iterator(const iterator &o):
3434
current_val(o.current_val), depthindex(nullptr) {
3535
depthindex = new scopeindex_t[pj.depthcapacity];
3636
if(depthindex != nullptr) {
37-
memcpy(o.depthindex, depthindex, pj.depthcapacity * sizeof(depthindex[0]));
37+
memcpy(depthindex, o.depthindex, pj.depthcapacity * sizeof(depthindex[0]));
3838
} else {
3939
tape_length = 0;
4040
}

0 commit comments

Comments
 (0)