Fix array detection/handling for GetEntPropString with string_t arrays (bug 6409).
This commit is contained in:
		
							parent
							
								
									4e275eea97
								
							
						
					
					
						commit
						5cdf35d687
					
				@ -1924,19 +1924,25 @@ static cell_t GetEntPropString(IPluginContext *pContext, const cell_t *params)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			bIsStringIndex = (td->fieldType != FIELD_CHARACTER);
 | 
								bIsStringIndex = (td->fieldType != FIELD_CHARACTER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (bIsStringIndex && (element < 0 || element >= td->fieldSize))
 | 
								if (element != 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (bIsStringIndex)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										if (element < 0 || element >= td->fieldSize)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						return pContext->ThrowNativeError("Element %d is out of bounds (Prop %s has %d elements).",
 | 
											return pContext->ThrowNativeError("Element %d is out of bounds (Prop %s has %d elements).",
 | 
				
			||||||
							element,
 | 
												element,
 | 
				
			||||||
							prop,
 | 
												prop,
 | 
				
			||||||
							td->fieldSize);
 | 
												td->fieldSize);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
			else if (element != 0)
 | 
									}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					return pContext->ThrowNativeError("Prop %s is not an array. Element %d is invalid.",
 | 
										return pContext->ThrowNativeError("Prop %s is not an array. Element %d is invalid.",
 | 
				
			||||||
						prop,
 | 
											prop,
 | 
				
			||||||
						element);
 | 
											element);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			offset = info.actual_offset;
 | 
								offset = info.actual_offset;
 | 
				
			||||||
			if (bIsStringIndex)
 | 
								if (bIsStringIndex)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user