[PATCH 2/3] storage.dll16: Correctly handle block values of -1.

Zebediah Figura z.figura12 at gmail.com
Mon Feb 20 08:23:04 CST 2017


On 02/20/2017 03:39 AM, Alexandre Julliard wrote:
> Zebediah Figura <z.figura12 at gmail.com> writes:
> 
>> @@ -610,9 +610,10 @@ STORAGE_get_nth_next_small_blocknr(stream_access16*str,int blocknr,int nr) {
>>  	READ_HEADER(str);
>>  	assert(blocknr>=0);
>>  	while ((nr--) && (blocknr>=0)) {
>> -		if (lastblocknr/128!=blocknr/128) {
>> +		if (lastblocknr>>7 != blocknr>>7)
>> +		{
>>  			int	bigblocknr;
>> -			bigblocknr = STORAGE_get_nth_next_big_blocknr(str,sth.sbd_startblock,blocknr/128);
>> +			bigblocknr = STORAGE_get_nth_next_big_blocknr(str,sth.sbd_startblock,blocknr>>7);
> 
> 
> I'm not sure what you are trying to fix. Most places already check that
> blocknr is >= 0, and if it's really negative, you can't rely on right
> shift doing the right thing.
> 

Without the patch, I get failed assertions in several places that the
blocknr is >= 0. With it, it seems to pass that -1 on to the program,
causing it not to crash. This might be fixing the symptom rather than
the cause, though.




More information about the wine-devel mailing list