Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of cppcheck warnings #63

Open
Harvie opened this issue Dec 5, 2020 · 0 comments
Open

Lots of cppcheck warnings #63

Harvie opened this issue Dec 5, 2020 · 0 comments

Comments

@Harvie
Copy link

Harvie commented Dec 5, 2020

$ cppcheck --force .
Checking frozen.c ...
frozen.c:866:49: error: Pointer addition with NULL pointer. [nullPointerArithmetic]
  char *send = (char *) src + slen, *dend = dst + dlen, *orig_dst = dst, *p;
                                                ^
frozen.c:949:67: note: Calling function 'json_unescape', 3rd argument 'NULL' value is 0
        int unescaped_len = json_unescape(token->ptr, token->len, NULL, 0);
                                                                  ^
frozen.c:866:49: note: Null pointer addition
  char *send = (char *) src + slen, *dend = dst + dlen, *orig_dst = dst, *p;
                                                ^
frozen.c:561:3: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
  va_copy(ap, xap);
  ^
frozen.c:572:30: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        int64_t val = va_arg(ap, int64_t);
                             ^
frozen.c:578:29: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        size_t val = va_arg(ap, size_t);
                            ^
frozen.c:583:43: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        json_printf_callback_t f = va_arg(ap, json_printf_callback_t);
                                          ^
frozen.c:584:24: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        len += f(out, &ap);
                       ^
frozen.c:586:26: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        int val = va_arg(ap, int);
                         ^
frozen.c:592:27: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        int i, n = va_arg(ap, int);
                          ^
frozen.c:593:41: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        const unsigned char *p = va_arg(ap, const unsigned char *);
                                        ^
frozen.c:603:41: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        const unsigned char *p = va_arg(ap, const unsigned char *);
                                        ^
frozen.c:604:24: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        int n = va_arg(ap, int);
                       ^
frozen.c:615:31: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
          l = (size_t) va_arg(ap, int);
                              ^
frozen.c:618:20: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        p = va_arg(ap, char *);
                   ^
frozen.c:652:9: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
        va_copy(ap_copy, ap);
        ^
frozen.c:676:13: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
            va_copy(ap_copy, ap);
            ^
frozen.c:696:25: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
          (void) va_arg(ap, int64_t);
                        ^
frozen.c:698:25: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
          (void) va_arg(ap, int);
                        ^
frozen.c:699:25: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
          (void) va_arg(ap, char *);
                        ^
frozen.c:704:29: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
              (void) va_arg(ap, int);
                            ^
frozen.c:741:3: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]
  va_end(ap);
  ^
frozen.c:652:9: error: va_list 'ap_copy' used before va_start() was called. [va_list_usedBeforeStarted]
        va_copy(ap_copy, ap);
        ^
frozen.c:653:48: error: va_list 'ap_copy' used before va_start() was called. [va_list_usedBeforeStarted]
        need_len = vsnprintf(pbuf, size, fmt2, ap_copy);
                                               ^
frozen.c:654:9: error: va_list 'ap_copy' used before va_start() was called. [va_list_usedBeforeStarted]
        va_end(ap_copy);
        ^
frozen.c:676:13: error: va_list 'ap_copy' used before va_start() was called. [va_list_usedBeforeStarted]
            va_copy(ap_copy, ap);
            ^
frozen.c:677:49: error: va_list 'ap_copy' used before va_start() was called. [va_list_usedBeforeStarted]
            vsnprintf(pbuf, need_len + 1, fmt2, ap_copy);
                                                ^
frozen.c:678:13: error: va_list 'ap_copy' used before va_start() was called. [va_list_usedBeforeStarted]
            va_end(ap_copy);
            ^
Checking frozen.c: JSON_ENABLE_BASE64...
Checking frozen.c: JSON_ENABLE_HEX...
Checking frozen.c: JSON_MINIMAL=0...
Checking frozen.c: WEAK...
Checking frozen.c: WEAK;_WIN32;__GNUC__;__TI_COMPILER_VERSION__...
Checking frozen.c: _WIN32...
Checking frozen.c: _WIN32;__GNUC__...
1/2 files checked 56% done
Checking unit_test.c ...
frozen.c:812:28: error: Pointer addition with NULL pointer. [nullPointerArithmetic]
  frozen.end = json_string + json_string_length;
                           ^
unit_test.c:122:3: note: Calling function 'json_walk', 1st argument 'NULL' value is 0
  ASSERT(json_walk(NULL, 0, NULL, 0) == JSON_STRING_INVALID);
  ^
frozen.c:812:28: note: Null pointer addition
  frozen.end = json_string + json_string_length;
                           ^
Checking unit_test.c: JSON_ENABLE_BASE64...
Checking unit_test.c: JSON_ENABLE_HEX...
Checking unit_test.c: JSON_MINIMAL=0...
Checking unit_test.c: WEAK...
Checking unit_test.c: WEAK;_WIN32;__GNUC__;__TI_COMPILER_VERSION__...
Checking unit_test.c: _MSC_VER...
Checking unit_test.c: _WIN32...
Checking unit_test.c: _WIN32;__GNUC__...
2/2 files checked 100% done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant