big repetitions of structure => multiple is negative / out of memory / wrong address
Reported by Ange Albertini | September 28th, 2011 @ 07:43 AM
Hi,
I made a simple piece of code that repeats the same structure.
- if i repeat it 8192 times, it's fine.
- if i repeat it 16384 times, i get 'multiple is negative'
- if i repeat it more, i get out of memory.
and sometimes, even if it's fine, $ becomes
corrupted (when using too many alignments ?) -> Yasm doesn't
know what line it's on, which leads to jmp $ + 2 not
being assembled as EB FE, or dd $ not
giving the right value.
Here is a simplified piece of code. even copy pasting the loop
several times gives the same bugs. Just increase the
%rep parameter.
struc IMAGE_SECTION_HEADER
.Name resb 8
.VirtualSize resd 1
.VirtualAddress resd 1
.SizeOfRawData resd 1
.PointerToRawData resd 1
.PointerToRelocations resd 1
.PointerToLinenumbers resd 1
.NumberOfRelocations resw 1
.NumberOfLinenumbers resw 1
.Characteristics resd 1
endstruc
bits 32
org 44000000h
%assign i 0
%rep 1 << 13
istruc IMAGE_SECTION_HEADER
at IMAGE_SECTION_HEADER.VirtualSize, dd 1000h
at IMAGE_SECTION_HEADER.VirtualAddress, dd 51000h + i * 1000h
at IMAGE_SECTION_HEADER.SizeOfRawData, dd 200h
at IMAGE_SECTION_HEADER.PointerToRawData, dd 50200h + i * 200h
at IMAGE_SECTION_HEADER.Characteristics, dd 0e00000c0h
iend
%assign i i + 1
%endrep
tested on yasm 1.1.0.2352 and
yasm-1.1.0.41.g0e3fa.exe
Comments and changes to this ticket
-

Peter Johnson September 30th, 2011 @ 08:05 PM
- → Assigned user set to Peter Johnson
This works fine on a 64-bit machine (tested up to 1<<18). On this sort of code yasm is very memory-hungry as you are creating a very large assembly input file with lots of TIMES expressions. There's probably also a 32-bit overflow happening somewhere due to the large ORG; I'll look into this.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Yasm Modular Assembler Project