Merge for v0.1.1 #57
							
								
								
									
										20
									
								
								engine/vm.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								engine/vm.c
									
									
									
									
									
								
							@@ -2553,13 +2553,13 @@ static sxi32 VmByteCodeExec(
 | 
				
			|||||||
						if(pIdx) {
 | 
											if(pIdx) {
 | 
				
			||||||
							sxu32 nOfft;
 | 
												sxu32 nOfft;
 | 
				
			||||||
							if((pIdx->nType & MEMOBJ_INT) == 0) {
 | 
												if((pIdx->nType & MEMOBJ_INT) == 0) {
 | 
				
			||||||
								/* Force an int cast */
 | 
													/* No available index */
 | 
				
			||||||
								PH7_MemObjToInteger(pIdx);
 | 
													PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Index was outside the bounds of the array");
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
							nOfft = (sxu32)pIdx->x.iVal;
 | 
												nOfft = (sxu32)pIdx->x.iVal;
 | 
				
			||||||
							if(nOfft >= SyBlobLength(&pTos->sBlob)) {
 | 
												if(nOfft >= SyBlobLength(&pTos->sBlob)) {
 | 
				
			||||||
								/* Invalid offset,load null */
 | 
													/* No available index */
 | 
				
			||||||
								PH7_MemObjRelease(pTos);
 | 
													PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Index was outside the bounds of the array");
 | 
				
			||||||
							} else {
 | 
												} else {
 | 
				
			||||||
								const char *zData = (const char *)SyBlobData(&pTos->sBlob);
 | 
													const char *zData = (const char *)SyBlobData(&pTos->sBlob);
 | 
				
			||||||
								int c = zData[nOfft];
 | 
													int c = zData[nOfft];
 | 
				
			||||||
@@ -2567,9 +2567,6 @@ static sxi32 VmByteCodeExec(
 | 
				
			|||||||
								MemObjSetType(pTos, MEMOBJ_STRING);
 | 
													MemObjSetType(pTos, MEMOBJ_STRING);
 | 
				
			||||||
								SyBlobAppend(&pTos->sBlob, (const void *)&c, sizeof(char));
 | 
													SyBlobAppend(&pTos->sBlob, (const void *)&c, sizeof(char));
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						} else {
 | 
					 | 
				
			||||||
							/* No available index,load NULL */
 | 
					 | 
				
			||||||
							MemObjSetType(pTos, MEMOBJ_NULL);
 | 
					 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
@@ -2599,8 +2596,8 @@ static sxi32 VmByteCodeExec(
 | 
				
			|||||||
					if(rc == SXRET_OK) {
 | 
										if(rc == SXRET_OK) {
 | 
				
			||||||
						/* Load entry contents */
 | 
											/* Load entry contents */
 | 
				
			||||||
						if(pMap->iRef < 2) {
 | 
											if(pMap->iRef < 2) {
 | 
				
			||||||
							/* TICKET 1433-42: Array will be deleted shortly,so we will make a copy
 | 
												/* TICKET 1433-42: Array will be deleted shortly, so we will make a copy
 | 
				
			||||||
							 * of the entry value,rather than pointing to it.
 | 
												 * of the entry value, rather than pointing to it.
 | 
				
			||||||
							 */
 | 
												 */
 | 
				
			||||||
							pTos->nIdx = SXU32_HIGH;
 | 
												pTos->nIdx = SXU32_HIGH;
 | 
				
			||||||
							PH7_HashmapExtractNodeValue(pNode, pTos, TRUE);
 | 
												PH7_HashmapExtractNodeValue(pNode, pTos, TRUE);
 | 
				
			||||||
@@ -2610,9 +2607,8 @@ static sxi32 VmByteCodeExec(
 | 
				
			|||||||
							PH7_HashmapUnref(pMap);
 | 
												PH7_HashmapUnref(pMap);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						/* No such entry, load NULL */
 | 
											/* No available index */
 | 
				
			||||||
						PH7_MemObjRelease(pTos);
 | 
											PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Index was outside the bounds of the array");
 | 
				
			||||||
						pTos->nIdx = SXU32_HIGH;
 | 
					 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user