Tag data must have count greater than zero
Zero counts are invalid, and they cause problems elsewhere. For instance, strtaglen() will suffer an integer underflow.
This commit is contained in:
parent
11f7c13e15
commit
5e40166380
|
@ -128,6 +128,13 @@ static const size_t headerMaxbytes = (256*1024*1024);
|
||||||
**/
|
**/
|
||||||
#define hdrchkTag(_tag) ((_tag) < HEADER_I18NTABLE)
|
#define hdrchkTag(_tag) ((_tag) < HEADER_I18NTABLE)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reasonableness check on count values.
|
||||||
|
* Catches nasty stuff like negative or zero counts, which would cause
|
||||||
|
* integer underflows in strtaglen().
|
||||||
|
*/
|
||||||
|
#define hdrchkCount(_count) ((_count) == 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sanity check on type values.
|
* Sanity check on type values.
|
||||||
*/
|
*/
|
||||||
|
@ -279,6 +286,8 @@ static rpmRC hdrblobVerifyInfo(hdrblob blob, char **emsg)
|
||||||
goto err;
|
goto err;
|
||||||
if (hdrchkType(info.type))
|
if (hdrchkType(info.type))
|
||||||
goto err;
|
goto err;
|
||||||
|
if (hdrchkCount(info.count))
|
||||||
|
goto err;
|
||||||
if (hdrchkAlign(info.type, info.offset))
|
if (hdrchkAlign(info.type, info.offset))
|
||||||
goto err;
|
goto err;
|
||||||
if (hdrchkRange(blob->dl, info.offset))
|
if (hdrchkRange(blob->dl, info.offset))
|
||||||
|
|
Loading…
Reference in New Issue