Skip to content

PVS-Studio warnings #140

Open
Open

Description

@Komzpa

It looks like PVS-Studio found several issues in the code:

  • 87 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { : snprintf(log_msg,PATH_MAX - 1, "Meta file %s header magic mismatch\n", path); :
  • 86 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. } : if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { :
  • 87 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { : snprintf(log_msg,PATH_MAX - 1, "Meta file %s header magic mismatch\n", path); :
  • 86 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. } : if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { :
  • 87 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { : snprintf(log_msg,PATH_MAX - 1, "Meta file %s header magic mismatch\n", path); :
  • 86 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. } : if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { :
  • 49 : src/store_ro_http_proxy.c V701 : realloc() possible leak: when realloc() fails in allocating memory, original pointer 'chunk->memory' is lost. Consider assigning realloc() to a temporary pointer. : false : 2 : if (chunk->memory) { : chunk->memory = realloc(chunk->memory, chunk->size + realsize); : } else { :
  • 182 : src/store_ro_http_proxy.c V524 : It is odd that the body of 'ro_http_proxy_metatile_expire' function is fully equivalent to the body of 'ro_http_proxy_metatile_delete' function. : false : 3 : : static int ro_http_proxy_metatile_expire(struct storage_backend * store, const char *xmlconfig, int x, int y, int z) { : : 177,182
  • 849 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_dirty")) : return DECLINED; :
  • 887 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_serve")) : return DECLINED; :
  • 988 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_status")) : return DECLINED; :
  • 1031 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_json")) : return DECLINED; :
  • 1103 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_mod_stats")) : return DECLINED; :
  • 1179 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_serve")) : return DECLINED; :
  • 1424 : src/mod_tile.c V566 : The integer constant is converted to pointer. Possibly an error or a bad coding style: (const void *) 1 : false : 3 : if (!data) { : apr_pool_userdata_set((const void *) 1, userdata_key, : apr_pool_cleanup_null, s->process->pool); :
  • 1499 : src/mod_tile.c V656 : Variables 'delayp->last_tile_fillup', 'delayp->last_render_fillup' are initialized through the call to the same function. It's probably an error or un-optimized code. Consider inspecting the 'apr_time_now()' expression. Check lines: 1498, 1499. : false : 3 : delayp->last_tile_fillup = apr_time_now(); : delayp->last_render_fillup = apr_time_now(); : : 1498,1499
  • 849 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_dirty")) : return DECLINED; :
  • 887 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_serve")) : return DECLINED; :
  • 988 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_status")) : return DECLINED; :
  • 1031 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_json")) : return DECLINED; :
  • 1103 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_mod_stats")) : return DECLINED; :
  • 1179 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_serve")) : return DECLINED; :
  • 1424 : src/mod_tile.c V566 : The integer constant is converted to pointer. Possibly an error or a bad coding style: (const void *) 1 : false : 3 : if (!data) { : apr_pool_userdata_set((const void *) 1, userdata_key, : apr_pool_cleanup_null, s->process->pool); :
  • 1499 : src/mod_tile.c V656 : Variables 'delayp->last_tile_fillup', 'delayp->last_render_fillup' are initialized through the call to the same function. It's probably an error or un-optimized code. Consider inspecting the 'apr_time_now()' expression. Check lines: 1498, 1499. : false : 3 : delayp->last_tile_fillup = apr_time_now(); : delayp->last_render_fillup = apr_time_now(); : : 1498,1499
  • 49 : src/store_ro_http_proxy.c V701 : realloc() possible leak: when realloc() fails in allocating memory, original pointer 'chunk->memory' is lost. Consider assigning realloc() to a temporary pointer. : false : 2 : if (chunk->memory) { : chunk->memory = realloc(chunk->memory, chunk->size + realsize); : } else { :
  • 182 : src/store_ro_http_proxy.c V524 : It is odd that the body of 'ro_http_proxy_metatile_expire' function is fully equivalent to the body of 'ro_http_proxy_metatile_delete' function. : false : 3 : : static int ro_http_proxy_metatile_expire(struct storage_backend * store, const char *xmlconfig, int x, int y, int z) { : : 177,182
  • 849 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_dirty")) : return DECLINED; :
  • 887 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_serve")) : return DECLINED; :
  • 988 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_status")) : return DECLINED; :
  • 1031 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_json")) : return DECLINED; :
  • 1103 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_mod_stats")) : return DECLINED; :
  • 1179 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_serve")) : return DECLINED; :
  • 1424 : src/mod_tile.c V566 : The integer constant is converted to pointer. Possibly an error or a bad coding style: (const void *) 1 : false : 3 : if (!data) { : apr_pool_userdata_set((const void *) 1, userdata_key, : apr_pool_cleanup_null, s->process->pool); :
  • 1499 : src/mod_tile.c V656 : Variables 'delayp->last_tile_fillup', 'delayp->last_render_fillup' are initialized through the call to the same function. It's probably an error or un-optimized code. Consider inspecting the 'apr_time_now()' expression. Check lines: 1498, 1499. : false : 3 : delayp->last_tile_fillup = apr_time_now(); : delayp->last_render_fillup = apr_time_now(); : : 1498,1499
  • 49 : src/store_ro_http_proxy.c V701 : realloc() possible leak: when realloc() fails in allocating memory, original pointer 'chunk->memory' is lost. Consider assigning realloc() to a temporary pointer. : false : 2 : if (chunk->memory) { : chunk->memory = realloc(chunk->memory, chunk->size + realsize); : } else { :
  • 182 : src/store_ro_http_proxy.c V524 : It is odd that the body of 'ro_http_proxy_metatile_expire' function is fully equivalent to the body of 'ro_http_proxy_metatile_delete' function. : false : 3 : : static int ro_http_proxy_metatile_expire(struct storage_backend * store, const char *xmlconfig, int x, int y, int z) { : : 177,182

Activity

  1. pnorman commented on Oct 6, 2016

    @pnorman
    Contributor

    Could you apply some formatting to make this more readable?

  2. Komzpa commented on Oct 6, 2016

    @Komzpa
    Author

    @pnorman applied some formatting - hope it is better.

  3. pantierra commented on Jul 28, 2021

    @pantierra
    Collaborator

    @Komzpa Would it be possible to get another input on the current code base? Thanks.

  4. Komzpa commented on Jul 29, 2021

    @Komzpa
    Author

    hi @xamanu
    you can do it by using the PVS-Studio yourself. they have free options:
    https://pvs-studio.com/en/blog/posts/0614/
    my temp key expired in 2016 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions