| 670 | } |
| 671 | |
| 672 | EFI_STATUS |
| 673 | GetInfo ( |
| 674 | IN VOID *Source, |
| 675 | IN UINT32 SrcSize, |
| 676 | OUT UINT32 *DstSize, |
| 677 | OUT UINT32 *ScratchSize |
| 678 | ) |
| 679 | /*++ |
| 680 | |
| 681 | Routine Description: |
| 682 | |
| 683 | The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo(). |
| 684 | |
| 685 | Arguments: |
| 686 | |
| 687 | Source - The source buffer containing the compressed data. |
| 688 | SrcSize - The size of source buffer |
| 689 | DstSize - The size of destination buffer. |
| 690 | ScratchSize - The size of scratch buffer. |
| 691 | |
| 692 | Returns: |
| 693 | |
| 694 | EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved. |
| 695 | EFI_INVALID_PARAMETER - The source data is corrupted |
| 696 | |
| 697 | --*/ |
| 698 | { |
| 699 | UINT8 *Src; |
| 700 | UINT32 CompSize; |
| 701 | |
| 702 | *ScratchSize = sizeof (SCRATCH_DATA); |
| 703 | |
| 704 | Src = Source; |
| 705 | if (SrcSize < 8) { |
| 706 | return EFI_INVALID_PARAMETER; |
| 707 | } |
| 708 | |
| 709 | CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24); |
| 710 | *DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24); |
| 711 | |
| 712 | if (SrcSize < CompSize + 8 || (CompSize + 8) < 8) { |
| 713 | return EFI_INVALID_PARAMETER; |
| 714 | } |
| 715 | |
| 716 | return EFI_SUCCESS; |
| 717 | } |
| 718 | |
| 719 | EFI_STATUS |
| 720 | Decompress ( |
no outgoing calls
no test coverage detected