Re: Buffers in Assembly (NASM)



On Jul 19, 9:28 am, Frank Kotler <spamt...@xxxxxxxxxx> wrote:
bwai...@xxxxxxxxx wrote:
I'm trying to better understand data structures in assembly. I know I
can create a zero filled buffer in the bss section in NASM with this:

buffer: times 64 db 0

Hi Brian,

Well... In -f obj (OMF) output format, Nasm will tolerate this - since
it doesn't know what ".bss" means. In (all?) other formats, this will
generate a warning (64 of 'em, actually) "attempt to initialize memory
in a nobits section: ignored". In an uninitialized (.bss) section,
there's "nothing there", so it would be "conceptually impossible" for
Nasm to zero it. That would be the right way to do it in an initialized
(.data) section.

The is correct. A typo on my part; belongs to the data section.

I am assembling the file on windows since my only *nix box is 64 bit,
and I'm curious about 32 bit asm on windows. Where can I get more
information on the obj (OMF) format since that is what I am using
before using alink to link the file to a PE file? And how do I debug
the program in ollydbg if I don't break the program into sections?

I'm basically just creating a buffer to write strings for functions
like snprintf, so that I can write output to a messageboxa. My goal
is to understand both ways of creating a buffer, so that I have more
flexibility.

Thanks,

Brian

.



Relevant Pages

  • Re: Buffers in Assembly (NASM)
    ... can create a zero filled buffer in the bss section in NASM with this: ... it doesn't know what ".bss" means. ... In an uninitialized section, there's "nothing there", so it would be "conceptually impossible" for Nasm to zero it. ... mov al, 'N' ...
    (comp.lang.asm.x86)
  • Re: Lisp vs. I/O
    ... > So does the user then grab that buffer out of the stream and frob it ... I don't want a stream interface, ... of what it means to "overlay any foreign type" over the workspace. ... IBM 360/370 formats, which feature a radix 16 exponent, ...
    (comp.lang.lisp)
  • Re: Blueflops ate my X
    ... .bss section. ... dos, or of a "dos box" started raising an "illegal operation" in ... I suspect that this may affect some of the "asmutils" utilities, ... But marking the ".text" section "write" (which the friendly Nasm manual says works) still segfaults! ...
    (alt.lang.asm)
  • Re: static char overflow
    ... > you can see your buffer is located at bss section and there isnt another ... There is no static heap section afterwards, ... entire dynamic heap is initialized after the .bss section, ... I heard that it can be exploited in old linux if it is ...
    (Vuln-Dev)
  • Re: referring to segments other than DS - how?
    ... only have 16-bit registers, and I've got a buffer in BSS, how do I write ... needs the address of the buffer to be in DS:DX, so I have to move the BSS ... EncFileHandle; file handle to bx ... I'm trying not to use 32-bit registers. ...
    (alt.lang.asm)