Browse Source

Fix NULL deref in duk_is_fixed/dynamic_buffer()

pull/222/head
Sami Vaarala 10 years ago
parent
commit
9ff7caba07
  1. 4
      src/duk_api_stack.c

4
src/duk_api_stack.c

@ -2758,7 +2758,7 @@ DUK_EXTERNAL duk_bool_t duk_is_dynamic_buffer(duk_context *ctx, duk_idx_t index)
DUK_ASSERT_CTX_VALID(ctx);
tv = duk_get_tval(ctx, index);
if (DUK_TVAL_IS_BUFFER(tv)) {
if (tv && DUK_TVAL_IS_BUFFER(tv)) {
duk_hbuffer *h = DUK_TVAL_GET_BUFFER(tv);
DUK_ASSERT(h != NULL);
return (DUK_HBUFFER_HAS_DYNAMIC(h) ? 1 : 0);
@ -2772,7 +2772,7 @@ DUK_EXTERNAL duk_bool_t duk_is_fixed_buffer(duk_context *ctx, duk_idx_t index) {
DUK_ASSERT_CTX_VALID(ctx);
tv = duk_get_tval(ctx, index);
if (DUK_TVAL_IS_BUFFER(tv)) {
if (tv && DUK_TVAL_IS_BUFFER(tv)) {
duk_hbuffer *h = DUK_TVAL_GET_BUFFER(tv);
DUK_ASSERT(h != NULL);
return (DUK_HBUFFER_HAS_DYNAMIC(h) ? 0 : 1);

Loading…
Cancel
Save