Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Bug: Segfault state_history_plugin when fetch_block: true #7136

Closed
vtsurka opened this issue Apr 16, 2019 · 2 comments
Closed

Bug: Segfault state_history_plugin when fetch_block: true #7136

vtsurka opened this issue Apr 16, 2019 · 2 comments
Assignees
Labels

Comments

@vtsurka
Copy link

vtsurka commented Apr 16, 2019

I run node from snapshot and exists state-history. If in get_blocks_request_v0 we set fetch_block: true it will be throw segfault.
Code from state_history_plugin.cpp

   void get_block(uint32_t block_num, fc::optional<bytes>& result) {
      chain::signed_block_ptr p;
      try {
         p = chain_plug->chain().fetch_block_by_number(block_num);
      } catch (...) {
         return;
      }
      result = fc::raw::pack(*p);
   }

I think we need to add condition on null result and maybe some warning log

if (p) {
      result = fc::raw::pack(*p);
}
@taokayan taokayan added the bug label Apr 23, 2019
@taokayan
Copy link
Contributor

nice catch @vtsurka

tbfleming added a commit that referenced this issue May 20, 2019
tbfleming added a commit that referenced this issue May 20, 2019
@heifner
Copy link
Contributor

heifner commented Oct 7, 2019

Fixed by #7384

@heifner heifner closed this as completed Oct 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants