* [Patch 1/6] BaseTools/Split: Fix the segmentation fault in GetSplitValue()
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
@ 2017-07-27 1:42 ` Yonghong Zhu
2017-07-27 1:42 ` [Patch 2/6] BaseTools/GenSec: Fix a segmentation fault in main() Yonghong Zhu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Yonghong Zhu @ 2017-07-27 1:42 UTC (permalink / raw)
To: edk2-devel; +Cc: chenbo, Liming Gao
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=538
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
BaseTools/Source/C/Split/Split.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c
index 7ab66be..6b0a323 100644
--- a/BaseTools/Source/C/Split/Split.c
+++ b/BaseTools/Source/C/Split/Split.c
@@ -1,10 +1,10 @@
/** @file
Split a file into two pieces at the request offset.
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -78,11 +78,11 @@ Returns:
GC_TODO: add return values
--*/
{
Version();
- printf ("Copyright (c) 1999-2016 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.\n");
printf ("\n SplitFile creates two Binary files either in the same directory as the current working\n");
printf (" directory or in the specified directory.\n");
printf ("\nUsage: \n\
Split\n\
-f, --filename inputFile to split\n\
@@ -101,17 +101,21 @@ EFI_STATUS
GetSplitValue (
IN CONST CHAR8* SplitValueString,
OUT UINT64 *ReturnValue
)
{
- UINT64 len = strlen(SplitValueString);
+ UINT64 len = 0;
UINT64 base = 1;
UINT64 index = 0;
UINT64 number = 0;
CHAR8 lastCHAR = 0;
EFI_STATUS Status = EFI_SUCCESS;
+ if (SplitValueString != NULL){
+ len = strlen(SplitValueString);
+ }
+
if (len == 0) {
return EFI_ABORTED;
}
Status = AsciiStringToUint64 (SplitValueString, FALSE, ReturnValue);
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch 2/6] BaseTools/GenSec: Fix a segmentation fault in main()
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
2017-07-27 1:42 ` [Patch 1/6] BaseTools/Split: Fix the segmentation fault in GetSplitValue() Yonghong Zhu
@ 2017-07-27 1:42 ` Yonghong Zhu
2017-07-27 1:42 ` [Patch 3/6] BaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf() Yonghong Zhu
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Yonghong Zhu @ 2017-07-27 1:42 UTC (permalink / raw)
To: edk2-devel; +Cc: chenbo, Liming Gao
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=537
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
BaseTools/Source/C/GenSec/GenSec.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
index 9129b50..c0e4de2 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1,9 +1,9 @@
/** @file
Creates output file that is a properly formed section per the PI spec.
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -144,11 +144,11 @@ Returns:
fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME);
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
fprintf (stdout, "Options:\n");
@@ -1118,10 +1118,14 @@ Returns:
argv += 2;
continue;
}
if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--attributes") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Guid section attributes can't be NULL");
+ goto Finish;
+ }
if (stricmp (argv[1], mGUIDedSectionAttribue[EFI_GUIDED_SECTION_PROCESSING_REQUIRED]) == 0) {
SectGuidAttribute |= EFI_GUIDED_SECTION_PROCESSING_REQUIRED;
} else if (stricmp (argv[1], mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]) == 0) {
SectGuidAttribute |= EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
} else if (stricmp (argv[1], mGUIDedSectionAttribue[0]) == 0) {
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch 3/6] BaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf()
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
2017-07-27 1:42 ` [Patch 1/6] BaseTools/Split: Fix the segmentation fault in GetSplitValue() Yonghong Zhu
2017-07-27 1:42 ` [Patch 2/6] BaseTools/GenSec: Fix a segmentation fault in main() Yonghong Zhu
@ 2017-07-27 1:42 ` Yonghong Zhu
2017-07-27 1:42 ` [Patch 4/6] BaseTools/EfiRom: " Yonghong Zhu
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Yonghong Zhu @ 2017-07-27 1:42 UTC (permalink / raw)
To: edk2-devel; +Cc: chenbo, Liming Gao
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=536
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
BaseTools/Source/C/GenFfs/GenFfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index 91632a9..eaef8a2 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -1,9 +1,9 @@
/** @file
This file contains functions required to generate a Firmware File System file.
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -114,11 +114,11 @@ Returns:
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
fprintf (stdout, "Options:\n");
@@ -734,11 +734,11 @@ Returns:
argc -= 2;
argv += 2;
continue;
}
- Error (NULL, 0, 1000, "Unknown option", argv[0]);
+ Error (NULL, 0, 1000, "Unknown option", "%s", argv[0]);
goto Finish;
}
VerboseMsg ("%s tool start.", UTILITY_NAME);
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch 4/6] BaseTools/EfiRom: Fix a segmentation fault from vsprintf()/vfprintf()
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
` (2 preceding siblings ...)
2017-07-27 1:42 ` [Patch 3/6] BaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf() Yonghong Zhu
@ 2017-07-27 1:42 ` Yonghong Zhu
2017-07-27 1:42 ` [Patch 5/6] BaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf() Yonghong Zhu
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Yonghong Zhu @ 2017-07-27 1:42 UTC (permalink / raw)
To: edk2-devel; +Cc: chenbo, Liming Gao
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=534
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
BaseTools/Source/C/EfiRom/EfiRom.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
index c58c152..84322e3 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.c
+++ b/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -1,9 +1,9 @@
/** @file
Utility program to create an EFI option ROM image from binary and EFI PE32 files.
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -240,11 +240,11 @@ Returns:
//
// Try to open the input file
//
if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
- Error (NULL, 0, 0001, "Error opening file", InFile->FileName);
+ Error (NULL, 0, 0001, "Error opening file", "%s", InFile->FileName);
return STATUS_ERROR;
}
//
// Seek to the end of the input file and get the file size. Then allocate
// a buffer to read it in to.
@@ -1260,11 +1260,11 @@ Returns:
fprintf (stdout, "Usage: %s -f VendorId -i DeviceId [options] [file name<s>] \n\n", UTILITY_NAME);
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
fprintf (stdout, "Options:\n");
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch 5/6] BaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf()
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
` (3 preceding siblings ...)
2017-07-27 1:42 ` [Patch 4/6] BaseTools/EfiRom: " Yonghong Zhu
@ 2017-07-27 1:42 ` Yonghong Zhu
2017-07-27 1:42 ` [Patch 6/6] BaseTools/GenCrc32: Fix a bug to hand empty file for decode Yonghong Zhu
2017-08-01 2:41 ` [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Gao, Liming
6 siblings, 0 replies; 8+ messages in thread
From: Yonghong Zhu @ 2017-07-27 1:42 UTC (permalink / raw)
To: edk2-devel; +Cc: chenbo, Liming Gao
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=533
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
index a46ecf8..5368d22 100644
--- a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
+++ b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
@@ -4,11 +4,11 @@ This tool combines several PE Image files together using following format denote
FILE := EFILDR_HEADER
EFILDR_IMAGE +
<PeImageFileContent> +
The order of EFILDR_IMAGE is same as the order of placing PeImageFileContent.
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -82,11 +82,11 @@ Usage (
VOID
)
{
printf ("Usage: EfiLdrImage -o OutImage LoaderImage PeImage1 PeImage2 ... PeImageN\n");
printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 1999-2016 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.\n");
printf ("\n The EfiLdrImage tool is used to combine PE files into EFILDR image with Efi loader header.\n");
}
EFI_STATUS
CountVerboseLevel (
@@ -219,11 +219,11 @@ Returns:
if ((strlen(argv[0]) >= 2 && argv[0][0] == '-' && (argv[0][1] == 'v' || argv[0][1] == 'V')) || (stricmp (argv[0], "--verbose") == 0)) {
VerboseLevel = 1;
if (strlen(argv[0]) > 2) {
Status = CountVerboseLevel (&argv[0][2], strlen(argv[0]) - 2, &VerboseLevel);
if (EFI_ERROR (Status)) {
- Error (NULL, 0, 1003, "Invalid option value", argv[0]);
+ Error (NULL, 0, 1003, "Invalid option value", "%s", argv[0]);
return STATUS_ERROR;
}
}
argc --;
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch 6/6] BaseTools/GenCrc32: Fix a bug to hand empty file for decode
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
` (4 preceding siblings ...)
2017-07-27 1:42 ` [Patch 5/6] BaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf() Yonghong Zhu
@ 2017-07-27 1:42 ` Yonghong Zhu
2017-08-01 2:41 ` [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Gao, Liming
6 siblings, 0 replies; 8+ messages in thread
From: Yonghong Zhu @ 2017-07-27 1:42 UTC (permalink / raw)
To: edk2-devel; +Cc: chenbo, Liming Gao
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=535
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
BaseTools/Source/C/GenCrc32/GenCrc32.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenCrc32/GenCrc32.c b/BaseTools/Source/C/GenCrc32/GenCrc32.c
index e1e11c6..5153587 100644
--- a/BaseTools/Source/C/GenCrc32/GenCrc32.c
+++ b/BaseTools/Source/C/GenCrc32/GenCrc32.c
@@ -1,9 +1,9 @@
/** @file
Calculate Crc32 value and Verify Crc32 value for input data.
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -78,11 +78,11 @@ Returns:
fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
fprintf (stdout, "optional arguments:\n");
@@ -324,10 +324,14 @@ Returns:
VerboseMsg ("the size of the encoded file is %u bytes", (unsigned) FileSize + sizeof (UINT32));
} else {
//
// Verify Crc32 Value
//
+ if (FileSize < sizeof (UINT32)) {
+ Error (NULL, 0, 3000, "Invalid", "Input file is invalid!");
+ goto Finish;
+ }
Status = CalculateCrc32 (FileBuffer + sizeof (UINT32), FileSize - sizeof (UINT32), &Crc32Value);
if (Status != EFI_SUCCESS) {
Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
goto Finish;
}
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Patch 0/6] BaseTools: Fix some segmentation fault in Tools
2017-07-27 1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
` (5 preceding siblings ...)
2017-07-27 1:42 ` [Patch 6/6] BaseTools/GenCrc32: Fix a bug to hand empty file for decode Yonghong Zhu
@ 2017-08-01 2:41 ` Gao, Liming
6 siblings, 0 replies; 8+ messages in thread
From: Gao, Liming @ 2017-08-01 2:41 UTC (permalink / raw)
To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: chenbo@pdx.edu
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
> Sent: Thursday, July 27, 2017 9:42 AM
> To: edk2-devel@lists.01.org
> Cc: chenbo@pdx.edu; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [Patch 0/6] BaseTools: Fix some segmentation fault in Tools
>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>
> Yonghong Zhu (6):
> BaseTools/Split: Fix the segmentation fault in GetSplitValue()
> BaseTools/GenSec: Fix a segmentation fault in main()
> BaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf()
> BaseTools/EfiRom: Fix a segmentation fault from vsprintf()/vfprintf()
> BaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf()
> BaseTools/GenCrc32: Fix a bug to hand empty file for decode
>
> BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c | 6 +++---
> BaseTools/Source/C/EfiRom/EfiRom.c | 6 +++---
> BaseTools/Source/C/GenCrc32/GenCrc32.c | 8 ++++++--
> BaseTools/Source/C/GenFfs/GenFfs.c | 6 +++---
> BaseTools/Source/C/GenSec/GenSec.c | 8 ++++++--
> BaseTools/Source/C/Split/Split.c | 10 +++++++---
> 6 files changed, 28 insertions(+), 16 deletions(-)
>
> --
> 2.6.1.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 8+ messages in thread