* Pankaj Gupta ([email protected]) wrote:
>  Parse 'QEMU_VM_SECTION_FOOTER' in crash. This section is also
>  added by VM migration code to avoid misparsing.
> 
> Signed-off-by: Pankaj Gupta <[email protected]>
> ---
>  qemu-load.c | 4 ++++
>  qemu-load.h | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-load.c b/qemu-load.c
> index 7ee58a3..4b8313d 100644
> --- a/qemu-load.c
> +++ b/qemu-load.c
> @@ -972,6 +972,10 @@ qemu_load (const struct qemu_device_loader *devices, 
> uint32_t required_features,
>                       break;
>               if (sec == QEMU_VM_EOF)
>                       break;
> +             if (sec == QEMU_VM_SECTION_FOOTER) {
> +                     uint32_t footerSecId = get_be32 (fp);
> +                     continue;
> +                }

Yes, that should work.
One possible thing you could add in the future would be to compare the
footerSecId with the ID in the last received section - they should match, if
they don't then you could print a warning that you think you might have a 
corrupt
file.

Dave

>               if (sec == QEMU_VM_CONFIGURATION) {
>                       uint32_t len = get_be32 (fp);
>                       get_string_len (fp, name, len);
> diff --git a/qemu-load.h b/qemu-load.h
> index d5b2078..f4fbb06 100644
> --- a/qemu-load.h
> +++ b/qemu-load.h
> @@ -30,7 +30,8 @@ enum qemu_save_section {
>    QEMU_VM_SECTION_END,
>    QEMU_VM_SECTION_FULL,
>    QEMU_VM_SUBSECTION,
> -  QEMU_VM_CONFIGURATION = 0x07
> +  QEMU_VM_CONFIGURATION = 0x07,
> +  QEMU_VM_SECTION_FOOTER = 0x7e
>  };
>  
>  enum qemu_features {
> -- 
> 1.9.3
> 
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to