--------------------------------------------------------------------------------------- [BUG/PRB.] VFP 9.0 FIX - ALLOCATE MORE MEMORY FOR RUSHMORE QUERY OPTIMIZATION January 2024 --------------------------------------------------------------------------------------- CCB 1. BUG: In vfp9 (and vfp6, vfp7, vfp8), when using large index files for Rushmore Query Optimization, sometimes it will cause the memory access violation exception (exception code 0xC0000005), or the error "Index file is corrupted. Please rebuild it (Error 1066)". The bug was reported by Dave Kaat. 2. CAUSE: When using large index files for Rushmore Query Optimization, for example, RECCOUNT()=90000000. In VFP 9.0 and earlier versions, it will allocate (90000000 + 1002)/8 = 11250128 bytes memory to save the rushmore query data, sometimes it will cause the memory access violation exception (exception code 0xC0000005), or the error "Index file is corrupted. Please rebuild it (Error 1066)". In VFP Advanced, it will allocate ((90000000 + 1002) * 17/16 + 1002*16)/8 = 11955264 bytes memory to save the rushmore query data, so there is no the bug. There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Fun44f1e5 :: ; proc near push ebp ;0x0044f1e5 : 55 mov ebp , dword ptr [ esp + 8 ] ;0x0044f1e6 : 8b6c2408 ; ; ---------------------------------------------------------------------------- ; VFP 9.0 FIX - ALLOCATE MORE MEMORY FOR RUSHMORE QUERY OPTIMIZATION ; July 2023 ; ---------------------------------------------------------------------------- ; CCB ; ; In vfp9, when using large index files for Rushmore Query Optimization, ; sometimes it will cause the memory access violation exception (exception code 0xC0000005), ; or the error "Index file is corrupted. Please rebuild it (Error 1066)". ; In VFP Advanced, when using large index files for Rushmore Query Optimization, ; it will allocate more memory, so there is no the bug. ; ; 2023/7/7, by ccb ; cmp dword ptr vfpa_sys9138_data,00h je Label44f1ea mov eax , ebp shr eax , 04h add ebp , eax add ebp , 03EA0h Label44f1ea :: lea eax , dword ptr [ ebp + 2 ] ;0x0044f1ea : 8d4502 cdq ;0x0044f1ed : 99 and edx , 07h ;0x0044f1ee : 83e207 add eax , edx ;0x0044f1f1 : 03c2 sar eax , 03h ;0x0044f1f3 : c1f803 add eax , 07h ;0x0044f1f6 : 83c007 shr eax , 02h ;0x0044f1f9 : c1e802 shl eax , 02h ;0x0044f1fc : c1e002 test eax , eax ;0x0044f1ff : 85c0 je Label5e6f8c ;0x0044f201 : 0f84857d1900 push edi ;0x0044f207 : 57 lea edi , dword ptr [ eax + 4 ] ;0x0044f208 : 8d7804 pushd 00h ;0x0044f20b : 6a00 call Fun42db6a ;0x0044f20d : e858e9fdff test eax , eax ;0x0044f212 : 85c0 je Label5e6f90 ;0x0044f214 : 0f84767d1900 push esi ;0x0044f21a : 56 add edi , 0FFFFFFFCh ;0x0044f21b : 83c7fc mov dword ptr [eax] , edi ;0x0044f21e : 8938 lea esi , dword ptr [ eax + 4 ] ;0x0044f220 : 8d7004 xor eax , eax ;0x0044f223 : 33c0 call Fun49b3b7 ;0x0044f225 : e88dc10400 test esi , esi ;0x0044f22a : 85f6 je Label44f24f ;0x0044f22c : 7421 pushd 00h ;0x0044f22e : 6a00 push esi ;0x0044f230 : 56 pushd 03h ;0x0044f231 : 6a03 call Fun53ad17 ;0x0044f233 : e8dfba0e00 mov eax , ebp ;0x0044f238 : 8bc5 sar eax , 03h ;0x0044f23a : c1f803 mov dl , byte ptr [ esi + eax ] ;0x0044f23d : 8a1406 add eax , esi ;0x0044f240 : 03c6 and ebp , 07h ;0x0044f242 : 83e507 mov cl , byte ptr [ ebp + offset Data91fbd8 ] ;0x0044f245 : 8a8dd8fb9100 or dl , cl ;0x0044f24b : 0ad1 mov byte ptr [eax] , dl ;0x0044f24d : 8810 Label44f24f :: mov eax , esi ;0x0044f24f : 8bc6 pop esi ;0x0044f251 : 5e pop edi ;0x0044f252 : 5f pop ebp ;0x0044f253 : 5d ret 04h ;0x0044f254 : c20400 4. APPLIES TO: VFP 6.0.8167.0 VFP 6.0.8961.0 (SP5) VFP 7.0.0.9262 VFP 7.0.0.9465 (SP1) VFP 8.0.0.2521 VFP 8.0.0.3117 (SP1) VFP 9.0.0.2412 VFP 9.0.0.3504 (SP1) VFP 9.0.0.4611 (SP2) VFP 9.0.0.5015 (SP2) VFP 9.0.0.5411 (SP2) VFP 9.0.0.5721 (SP2) VFP 9.0.0.5815 (SP2) VFP 9.0.0.6303 (SP2) VFP 9.0.0.6602 (SP2) VFP 9.0.0.7423 (SP2) The bug has been fixed in VFP Advanced. 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com http://www.baiyujia.com/vfpdocuments/f_vfp9fix276.asp 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |