10000 fixed crash · lethalbrains/arangodb@94c2f4c · GitHub
[go: up one dir, main page]

Skip to content

Commit 94c2f4c

Browse files
committed
fixed crash
1 parent 49c39f6 commit 94c2f4c

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

arangod/Aql/AqlValue.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy,
152152
mustDestroy = false;
153153
switch (type()) {
154154
case VPACK_SLICE_POINTER:
155-
case VPACK_INLINE:
156155
doCopy = false;
156+
case VPACK_INLINE:
157157
// fall-through intentional
158158
case VPACK_MANAGED: {
159159
VPackSlice s(slice());
@@ -228,8 +228,8 @@ AqlValue AqlValue::getKeyAttribute(arangodb::AqlTransaction* trx,
228228
mustDestroy = false;
229229
switch (type()) {
230230
case VPACK_SLICE_POINTER:
231-
case VPACK_INLINE:
232231
doCopy = false;
232+
case VPACK_INLINE:
233233
// fall-through intentional
234234
case VPACK_MANAGED: {
235235
VPackSlice s(slice());
@@ -264,8 +264,8 @@ AqlValue AqlValue::getIdAttribute(arangodb::AqlTransaction* trx,
264264
mustDestroy = false;
265265
switch (type()) {
266266
case VPACK_SLICE_POINTER:
267-
case VPACK_INLINE:
268267
doCopy = false;
268+
case VPACK_INLINE:
269269
// fall-through intentional
270270
case VPACK_MANAGED: {
271271
VPackSlice s(slice());
@@ -305,8 +305,8 @@ AqlValue AqlValue::getFromAttribute(arangodb::AqlTransaction* trx,
305305
mustDestroy = false;
306306
switch (type()) {
307307
case VPACK_SLICE_POINTER:
308-
case VPACK_INLINE:
309308
doCopy = false;
309+
case VPACK_INLINE:
310310
// fall-through intentional
311311
case VPACK_MANAGED: {
312312
VPackSlice s(slice());
@@ -341,8 +341,8 @@ AqlValue AqlValue::getToAttribute(arangodb::AqlTransaction* trx,
341341
mustDestroy = false;
342342
switch (type()) {
343343
case VPACK_SLICE_POINTER:
344-
case VPACK_INLINE:
345344
doCopy = false;
345+
case VPACK_INLINE:
346346
// fall-through intentional
347347
case VPACK_MANAGED: {
348348
VPackSlice s(slice());
@@ -378,8 +378,8 @@ AqlValue AqlValue::get(arangodb::AqlTransaction* trx,
378378
mustDestroy = false;
379379
switch (type()) {
380380
case VPACK_SLICE_POINTER:
381-
case VPACK_INLINE:
382381
doCopy = false;
382+
case VPACK_INLINE:
383383
// fall-through intentional
384384
case VPACK_MANAGED: {
385385
VPackSlice s(slice());
@@ -420,8 +420,8 @@ AqlValue AqlValue::get(arangodb::AqlTransaction* trx,
420420
mustDestroy = false;
421421
switch (type()) {
422422
case VPACK_SLICE_POINTER:
423-
case VPACK_INLINE:
424423
doCopy = false;
424+
case VPACK_INLINE:
425425
// fall-through intentional
426426
case VPACK_MANAGED: {
427427
VPackSlice s(slice());

arangod/Aql/AqlValue.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ struct AqlValue final {
120120

121121
// construct boolean value type
122122
explicit AqlValue(bool value) {
123-
initFromSlice(value ? arangodb::basics::VelocyPackHelper::TrueValue() : arangodb::basics::VelocyPackHelper::FalseValue());
123+
VPackSlice slice(value ? arangodb::basics::VelocyPackHelper::TrueValue() : arangodb::basics::VelocyPackHelper::FalseValue());
124+
memcpy(_data.internal, slice.begin(), slice.byteSize());
125+
setType(AqlValueType::VPACK_INLINE);
124126
}
125127

126128
// construct from std::string
@@ -323,12 +325,10 @@ struct AqlValue final {
323325
}
324326

325327
/// @brief initializes value from a slice
326-
void initFromSlice(arangodb::velocypack::Slice const& slice) {
328+
void initFromSlice(arangodb::velocypack::Slice slice) {
327329
if (slice.isExternal()) {
328330
// recursively resolve externals
329-
_data.pointer = slice.resolveExternals().start();
330-
setType(AqlValueType::VPACK_SLICE_POINTER);
331-
return;
331+
slice = slice.resolveExternals();
332332
}
333333
arangodb::velocypack::ValueLength length = slice.byteSize();
334334
if (length < sizeof(_data.internal)) {

arangod/Aql/EnumerateListBlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ AqlItemBlock* EnumerateListBlock::getSome(size_t, size_t atMost) {
130130

131131
for (size_t j = 0; j < toSend; j++) {
132132
if (j > 0) {
133-
// re-use already copied aqlvalues
133+
// re-use already copied AqlValues
134134
for (RegisterId i = 0; i < cur->getNrRegs(); i++) {
135135
res->setValue(j, i, res->getValueReference(0, i));
136136
// Note that if this throws, all values will be

0 commit comments

Comments
 (0)
0