(gdb) n 134 a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; (gdb) n (gdb) p a $30 = <value optimized out> (gdb) p b $31 = <value optimized out> (gdb) p c $32 = 3735928563 How can gdb optimize out my value?? read more
For C++ development for 32-bit systems (be it Linux, Mac OS or Windows, PowerPC or x86) I have initialised pointers that would otherwise be undefined (e.g. they can not immediately get a proper value) like so: int *pInt = reinterpret_cast<int *>(0xDEADBEEF); (To save typing and being DRY the right-hand side [...] read more
When given a file with an armored public GnuPG key, i.e. a file (pubkey.gpg) that was created with: gpg -r 0xDEADBEEF --export --armored > pubkey.gpg What is the best way to get information such as the finger print in that file, without importing it into my keyring? The best way [...] read more
WHAT I NEED I'm looking for a tool or a script that allows me to access the Windows volume levels from the command line. Ideally it would allow me to get and set all volumes including application levels, but I'd settle for only getting, and only the master level. I [...] read more
Goal: Build an Android app that discovers the names and addresses of BT devices within range and submits their values to a webservice. BT devices have not been previously bonded to the host device, I just want to poll everything as I walk about. What I've done: 1. Pored over [...] read more
This question was put on hold as too broad, presumably because of the research I included in an effort to "show my work" instead of asking a low effort question. To remedy this, allow me to summarize the entire question in a single sentence (credit to @PeterCordes for this phrase): [...] read more
I've recently been (relearning) lower level CS material and I've been exploring buffer overflows. I created a basic C program that has an 8-byte array char buffer[8];. I then used GDB to explore and disassemble the program and step through its execution. I'm on a 64-bit version of Ubuntu, and [...] read more
All of the tutorials I could find on setting up single-sign on into an Apache-hosted website using Active Directory authentication do so by configuring Kerberos with insecure settings. It's been best practice for awhile now to disable RC4-HMAC encryption for Kerberos in Active Directory, but a lot of tutorials call [...] read more
The microcontroller is an STM32 F767ZI, which contains a 32 bit ARM Cortex M7 When setting values to the registers, the registers all appear to be offset by 1. For example, the following code: core.S .syntax unified .cpu cortex-m7 .fpu softvfp .thumb // Global memory locations .global vtable .global reset_handler [...] read more
I am wondering is there any single event that can capture the L1D cache misses. I tried to capture L1d cache miss by measuring latency to access specific memory with rdtsc at the beginning. On my setting, if the L1d cache miss happens, it should hit L2 cache. Therefore I [...] read more
I have a binary data-set of known size that arrives in fixed-sized chunks. The chunks are out of order, but their position in the final result is known when I get them. Here is a simple example: from random import sample, seed import numpy as np chunk_size = 10 chunk_count [...] read more
Running /usr/sbin/tcpdump -n dst ${some_ip} and dst port 80 on two different but similar (distro, version) servers gives me different capture sizes (65535 bytes for one, 262144 bytes for another). What might cause this difference in tcpdump capture size? What discrepencies might it cause in resulting data output? EDIT: ldd [...] read more
I am trying to execute some UEFI applications. I found this code crashes on VirtualBox (test success is not printed while test start is printed): #include <stdint.h> void* ConOut; uint64_t (*OutputString)(void* protocol, void* string); void printChar(int c) { unsigned char data[4] = { (unsigned char)c }; if (c == '\n') [...] read more
I have a custom file upload field that uploads files immediately once you select/drop them, and returns a UUID for later submission. So, basically what most webapps do nowadays (e.g. Facebook, Twitter, etc.) when you drop a file. This is all easy enough to handle with final-form - my field [...] read more
What is the process for generating a bare metal binary with MSVC tools? In GNU land, you cc compile or as assemble the sources into object files, ld link the object files into an ELF (with a linker script) and then objcopy the relevant sections out of the ELF as [...] read more
I am learning bare-metal programming, I tried to send data out through the UART of LM3S811 in Qemu. But it did not print any characters in the terminal. I have provided the .c file and the linker script. It would help if there are any links to learn bare-metal Programming [...] read more
I'm trying to understand how to prove efficiently using Z3 that a somewhat simple function f : u32 -> u32 is bijective: def f(n): for i in range(10): n *= 3 n &= 0xFFFFFFFF # Let's treat this like a 4 byte unsigned number n ^= 0xDEADBEEF return n I [...] read more
As far as I understand it std::atomic<uint32_t> foo will create an atomic variable for me, but the actual memory location will be decided by the linker. On the other hand std::atomic<uint32_t*> bar will create an atomic pointer, i.e. the pointer itself is protected, but not the target it points to. [...] read more
I'm trying to debug a program running remotely on a board with a MIPS cpu, using musl for its libc. If I start gdbserver on the board, set the sysroot via set sysroot /path/to/sysroot and connect live from gdb, I get a meaningful stack trace (which took hours of effort [...] read more
I'm trying to understand the behaviour of the GNU linker and how sections are treated. I'm editing the stm32_flash.ld file in this stm32 project. When I modify the linker script to put the following as the first section: .my_test : { . = ALIGN(4); KEEP(*(.my_test)) LONG(0xdeadbeef); . = ALIGN(4); } [...] read more
Working on a project that must run in Visual C++ and GCC Before understanding that lvalue casting of the assignment operator in C is not allowed, I was writing code like this in VC++: typedef uint64_t QWORD; QWORD A = 0xdeadbeef, T = 0; (char)A = T; Notice the (char)A [...] read more
I had some contact with the CRC-16 checksum in the past and was accustomed to verifying it by recalculating the CRC-16 checksum over the file I want to verify, plus the 2 bytes of the CRC-16 itself. If the result was zero, then the file integrity was valid, otherwise not. [...] read more
I am unable to compile to c program for 32bit machine from 64bit linux machine using command gcc -m32 -Werror a.c -o a It shows me the error In file included from a.c:1: /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory #include <bits/libc-header-start.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. I check the [...] read more
In gdb, if you have a pointer to something, you can cast it before printing it. For example, this works: print *(int*) 0xDEADBEEF However, how do I print a std::vector<T>? Specifically a std::vector<std::string>? If it's std::string, I can do it with std::__cxx11::string, which whatis std::string outputs, but I can't convince [...] read more
I would like to set up a read-only key-server operating by me where I am going to publish my own keys. So that anyone could do gpg --keyserver example.mymedia.su --receive-keys 0xDEADBEEF and get the key. Is it some sort of HTTP server? Is it enough to just put static files [...] read more
I'm trying to capture some Ethernet frames with Linux. Some of these packets/frames are invalid and contain corrupted data. For example an Ethernet frame contains the type 0x0800 which is IPv4, but the following data contain just random bytes. Furthermore, the source and destination MAC are unknown and not predictable. [...] read more
So I just recently upgraded to Mountain Lion and so I needed to upgrade Xcode to the newest version. Well everything was going fine during the download but then about 1 minute after it started installing my computer just instantly crashed and rebooted. When I got back into OS X, [...] read more
Can std::memmove() be used to "move" the memory to the same location to be able to alias it using different types? For example: #include <cstring> #include <cstdint> #include <iomanip> #include <iostream> struct Parts { std::uint16_t v[2u]; }; static_assert(sizeof(Parts) == sizeof(std::uint32_t), ""); static_assert(alignof(Parts) <= alignof(std::uint32_t), ""); int main() { std::uint32_t u [...] read more
I have two integer variables: int i1 = 0xdeadbeef and int i2 = 0xffffbeef. (11011110101011011011111011101111 or 37359285591 and 111111111111111110111110111011111 or 4294950639 respectively). -------------------------------------------------------------------------------- (int) (float) i1 == i1 evaluates as false, yet (int) (float) i2 == i2 evaluates as true. Why is this? In this system, both ints and floats [...] read more
This answer properly explains about null pointers. In the last paragraph under Null Pointers it says > If the underlying architecture has a null pointer value defined as address > 0xDEADBEEF, then it is up to the compiler to sort this mess out. Now if some architecture internally defines Null [...] read more
I'm trying to hook BIOS Int 13h to add my custom functionality to it and hijack some of existing one. Old Int 13h vector is stored in global variable. When interrupt handler is called the DS is set to some value that doesn't match the original data segment of caller. [...] read more
I'm developing a program that needs to handle crash signals. By crash signal, I mean signals "delivered as a consequence of a hardware exception" [1], such as SIGFPE and SIGSEGV. I haven't found a specific name that describes this signal category, so I'm coming up with this one for clarity [...] read more
I am currently attempting to patch a target x86 PE file from the disk with a tool, patch.exe. purpose The purpose of this tool will be to eventually write/insert a multi-function payload into the target executable, who's purpose is to track the position of certain frames inside a game which [...] read more
I recently integrated this hash function into my react web app, here is the code: const cyrb53 = function(str, seed = 0) { let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; for (let i = 0, ch; i < str.length; i++) { ch = str.charCodeAt(i); h1 = [...] read more
When inter-procedural-analysis optimization (compiler flag) is enabled, the struct debug symbols (opaque-symbol-resolution) does not work. Any one knows why? Is it possible to have this optimization enabled but not lose this convenient debug capability? typedef struct mystruct { int a; char b; } mystruct_t; Without ipa enabled, (gdb) p /x [...] read more
I was just thinking about multi-threaded reference counting, searched for it and found many posts, that basicly only mention the problem of atomicity, many answers even here on stackoverflow miss the actual problems involved in multi-threaded reference counting. So what's the fundamental problem. Let's assume an object type with a [...] read more
System verilog allows numeric constants like this: 32'hdead_beef this is equivalent to the c value of 0xdeadbeef System verilog allows the bit width to be defined as well as the base. In general it is <bit-width-in-decimal>'<base><digits-and-underscore> <base> can be: * 'd' for decimal * 'h' for hexadecimal * 'o' for [...] read more
I have created the following two files to illustrate what my problem is. main.c #include <gtk/gtk.h> #include "app_struct.h" static void activation(GtkApplication *app, gpointer user_data); static void check_file(GFile *file); int main(int argc, char **argv) { int status; GtkApplication *test = gtk_application_new("idk.for.now.test", G_APPLICATION_FLAGS_NONE); g_signal_connect(test, "activate", G_CALLBACK(activation), NULL); status = g_application_run(G_APPLICATION(test), argc, argv); [...] read more
I am trying to link some C code into a bootloader that I have made, However after doing that, I'm not able to get QEMU to boot my raw file attached are the relevant parts of the bootloader, the makefile and linker scripts. EDIT: QEMU gives a "not a bootable [...] read more
I was trying to set a breakpoint on a heap struct variable programmatically: when a function is called, set a watchpoint to the memory pointed by one of its arguments. However, doing awatch *0xDEADBEEF, as expected watches when the struct is used explicitly; awatch *(my_struct*)0xDEADBEEF watches whenever something writes in [...] read more
I'm currently confused on how to use the pwntools library for python3 for exploiting programs - mainly sending the input into a vulnerable program. This is my current python script. from pwn import * def executeVuln(): vulnBin = process("./buf2", stdin=PIPE, stdout=PIPE) vulnBin.sendlineafter(': ','A'*90) output = vulnBin.recvline(timeout=5) print(output) executeVuln() The program [...] read more
How should an array with elements of a composite type be included in a function call? After consulting the resources online and attempting the different variants, I continue to get parser errors. Below I've included the types, tables, functions, and execution attempts. Type CREATE TYPE jobs_v0.insertable_program AS ( handle text, [...] read more
In the following example code, is there any undefined or implementation defined behavior? Can I assign a value to one member of a union and read it back from another? #include <stdio.h> #include <stdint.h> struct POINT { union { float Position[3]; struct { float X, Y, Z; }; }; }; [...] read more
I'm learning threading in C in OS. I don't know why following code is giving me segmentation fault. Can anyone help me here? I am also confused a bit about how pthread_join uses its argument void ** retval. What is its function? #include <pthread.h> #include <stdio.h> #include <stdlib.h> void *thread [...] read more
I'm trying to compile a kernel module for Linux. I have the following files: testuio.c and Makefile. When I type make all I get the following errors: $ make all make -C /lib/modules/`uname -r`/build M=/srv/dev-disk-by-label-tboWolfRaid/home/alex/ma/source/kernel_modules/memory modules make[1]: Entering directory '/usr/src/linux-headers-5.4.0-0.bpo.2-amd64' CC [M] /srv/dev-disk-by-label-tboWolfRaid/home/alex/ma/source/kernel_modules/memory/testuio.o In file included from /usr/include/unistd.h:25, from /srv/dev-disk-by-label-tboWolfRaid/home/alex/ma/source/kernel_modules/memory/testuio.c:13: [...] read more
In my code I have somewhere an uninitialized pointer that seems to get freed. The project is quite large and I cannot find the value. The problem is: once I attach a debugger, memory seems to be initialized with zero causing the pointer to be NULL and free not causing [...] read more
Is it possible to have a pseudo-random buffer fill pattern using FIO? ie, the fill pattern for a block would incorporate a seed + block number or offset into a pseudo-random fill generator. This way the entire fill data could be 100% repeatable and verifiable, but more varied than the [...] read more
Can two consecutive memory_order_release stores on the same thread be reordered with each other? Either from the perspective of the same thread or a different thread loading them? The documentation on CPP reference says: > A store operation with this memory order performs the release operation: no > reads or [...] read more
Say for instance I have a 32 element unsigned char array at address 0xdeadbeef. I would like to overwrite the contents of the array in memory. I am not compiled with -g, and so cannot just do a "set [variable name] = [my value]". Is it possible to set the [...] read more
In order to improve my binary exploitation skills, and deepen my understanding in low level environments I tried solving challenges in pwnable.kr, The third challenge- called bof has the following C code: #include <stdio.h> #include <string.h> #include <stdlib.h> void func(int key){ char overflowme[32]; printf("overflow me : "); gets(overflowme); // smash [...] read more
As fas as I understand, result_of_t should be a type, that will be at the end of the evaluation of an expression. decltype(&foo) in the code below yields the type int (*)(int), but what does (int) outside of decltype? #include <type_traits> int foo(int) { return 0xdeadbeef; } int main() { [...] read more
I'm investigation how different compilers handle unaligned access of structure bitfields members as well as members that cross the primitive types' boundaries, and I think MinGW64 is bugged. My test program is: #include <stdint.h> #include <stdio.h> /* Structure for testing element access The crux is the ISO C99 6.7.2.1p10 item: [...] read more
I Have a hash function like this. class Hash { static rotate (x, b) { return (x << b) ^ (x >> (32-b)); } static pcg (a) { let b = a; for (let i = 0; i < 3; i++) { a = Hash.rotate((a^0xcafebabe) + (b^0xfaceb00c), 23); b = [...] read more
I am trying to create a constexpr std::array with precompiled handler functions for my emulator. The code below works just fine for smaller numbers like 0x250, but everything above causes a 'C1026 parser overflow, program too complex' when used with the recent version of MSVC. #include <array> #include <iostream> template<typename [...] read more
I'm using BGL to build a graph storing bundled vertices where one type of vertex stores a reference to the other vertex type. Both types are handled using std::variant: struct simple_node_t { size_t enabled; }; struct complex_node_t { bool foo1; size_t foo2; simple_node_t& control; }; using vertex_t = std::variant<simple_node_t, complex_node_t>; [...] read more
I have run into a dead end here. I am trying to install an Intel AX200 WIFI + Bluetooth network card onto my desktop PC. I connected it to a PCIe port that had more slots than needed but I read that this should be fine. Additionally, a cable from [...] read more
I'm trying to create an object-oriented class using GNU assembly for educational purposes. I have many questions regarding the use of the .struct directive: 1. It is said that this directive switch the code to the absolute section. Why is it named .struct then? Does it have anything to do [...] read more
I have a dictionary (dict1) dict1={ 'lala':{ 'name':'lala', 'lula':0xcafecafe, }, 'mene':{ 'name':'mene', 'lula':0xdeadbeef, },} After that i created a register class to parse in the information class register: def __init__(self,name): self.name = dict1[name].get('name') self.data = dict1[name].get('lula') def self_add(self): value = self.data + self.data print('self_add value : {}'.format(value)) and create a [...] read more
I have an array of strings where each string can also be clearly identified by a unique pointer assigned to it. The order of the elements in that array often changes, for example because of sorting. I want to be able to quickly find the numeric index of an array [...] read more
I recently need to use in build NVRAM/EEPROM of AT32UC3L0256 to store some configuration data. I finally managed to use the user page NVRAM of the MCU (after days of trial and error and cursing on GCC ignoring noinit directives and fixing and workarounding bugs in ASF as usual) to [...] read more
(Asking again without the download link) Problem Description Nana told me that buffer overflow is one of the most common software vulnerability. Is that true? bof.c #include <stdio.h> #include <string.h> #include <stdlib.h> void func(int key){ char overflowme[32]; printf("overflow me : "); gets(overflowme); // smash me! if(key == 0xcafebabe){ system("/bin/sh"); } [...] read more
I am trying to use the process_vm_readv systemcall to read a value from another Linux process. When attempting to read a magic number at a known location, I receive a random value. I have tried writing two simple programs to see if I can get it working but I have [...] read more
I have built a custom hardware configuration in Vivado for Xilinx SoC board, and used petalinux to create a custom driver to control the hardware logic. It seems like after running insmod command, the driver is never initialized and the ->probe() function is not called. I am new to this [...] read more
Using GDB 10.1, I set a watchpoint like this on std::array<Data, 1024> m_slots: (gdb) print &m_slots[0] $1 = (std::array<Data, 1024>::value_type *) 0xdeadbeef (gdb) watch *(Data*) 0xdeadbeef where Data is a struct. GDB can print sizeof(Data) = 32 and successfully sets the (hardware) watchpoint. The watchpoint fires when the object is [...] read more
Kernel is 5.8, wifi driver is the intel iwlwifi version for ax200 requiring a kernel of at least 5.1 and the wifi card appears in lspci -k but nothing I've tried is working as I can't find any documentation from intel surrounding this or any other thread someone has asked, [...] read more
I'm trying to work with low level types like floats and doubles, in a program where they are 'encrypted' however, when I tried to create a structure that looked like this: struct rgba { float r, g, b, a; }; //and reference it like this: rgba color; reinterpret_cast<uint64_t>(color.a) ^= 0xDEADBEEF; [...] read more
I am using RISC-V Board Dev B and platform IO on Mac OS but debug is not working with some errors even though I successfully built and uploaded the project. Anyone can help this out? I will be appreciate if you can solve this problem. I tried to change the [...] read more
Can somebody please explain what does CMP dword ptr [EBP + local_c], 0xdeadbeef means. As far as I understand it compare the EBP+local_c location value with 0xdeadbeef, but I am not sure if that is true. Thanks in advance read more
This question pertains to the symbolic execution platform angr. Particularly, I want to ask two questions: 1. How to find a symbolic expression for the address operand of a load instruction? 2. How to add a constraint to a state, where the aforementioned address is a known value? To give [...] read more
I'd say I'm decent in C++, however I'm very new to linker scripts and I'm not quite sure what I'm doing wrong. First off all, this is my linker script: ENTRY(ISR_Reset) MEMORY { FLASH (rx) : ORIGIN = 0x80000, LENGTH = 128K RAM (rwx) : ORIGIN = 0x20000000 LENGTH = [...] read more
If I want to redirect execution to another function in assembly, I can do something like this: push 0deadbeefh ; function pointer to some random function ret But lets say, in C void* func_ptr = (void*) 0xdeadbeef; Assuming I have the above variable storing a function pointer to a random [...] read more
On Linux, you can allocate memory at a specific address like so: void *foo = (void *)0xDEADBEEF; size_t MyLength = 1024; void *bar = mmap(foo, MyLength, PROT_READ | PROT_WRITE | MAP_ANONYMOUS | MAP_FIXED, MAP_PRIVATE, -1, 0); Is this same method also possible on Mac OS, or if not, how does [...] read more
I'm practicing with ROPchain and I have a very simple program, where I'm unable to call the 'vulnerable' function successfully: #include <stdio.h> #include <string.h> #include <stdlib.h> void vuln(int a, int b) { if (a == 0xdeadbeef && b == 231) { system("/bin/sh\00"); } } int main() { char buf[32]; printf("Input: [...] read more
I have an application in which I've experienced some rare segmentation faults due to nullptr dereferences. The pointer values in the application follow a pretty standard life cycle: 1. I initialize them to nullptr. 2. They get set to a value at some point early on when information becomes available [...] read more
I am trying to follow this basic program involving pointer into the memory. At first We define counter to be 0 (outside main) then we make p_int to point at the same address as a counter. But when i go into the loop for some reason it compares the register [...] read more
I'm trying to create debug visualizers for our company custom smart pointers. I would like to use ExpandItem to get the contents just one level down, which works for concrete types like ref_ptr<Vector2d>, but not for virtual types like ref_ptr<IStreamManager>. When using the virtual types, I get two entries, one [...] read more
[Edit] This turned out to be a hardware issue. A separate thread was turning on a radio power amplifier, & my Power supply current limit was tripping. The other thread was always activating exactly when this instruction was executing] I'm struggling with this crash when debugging my project. The CPU [...] read more
I created a program that writes registers data into variables using asm. And it seems to be working well. But then I decided to replace variables by an array and to write registers data into an array. I used the same approach, but noticed that when I'm printing variables and [...] read more
I am new to binary exploitation problems. This one comes from picoctf 2019, leap-frog. The particular solution I'm interested in uses a buffer overflow on the vuln() function to force execution to return to gets' PLT entry. This is done because gets allows us to write to an arbitrary place [...] read more
Say I have a float I'd like to get the word value of: float f = 42.0f; // 0xDEADBEEF There are two options I know of. 1. Type-pun with std::cout << *(int*)&f; This is undefined behavior, and I don't care to use a char* as an exception (as shown here: [...] read more
I am trying to generate a 512bit pattern where the word 0xdeadbeef keeps rotating (shifted left by one) across the 512bits, each time I want to right the data to memory. Baiscally, 0xffffffff.......deadbeefffffffff (512 bits total). Keep shifting the deadbeef part by one and after each time write the whole [...] read more
Function Of Service export const deviceInfoRequest = async (callback) => { var request = new DeviceInfoMessage(); var AuthToken = 'ciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'; client.deviceInfo(request, {'x-authorization': AuthToken}, (err, response) => { var dataDevicename = response.getDevicename(); var dataDeviceid = response.getDeviceid(); console.log("DeviceName==>>>>",dataDevicename); console.log("DeviceId==>>>>",dataDeviceid); this.callback(dataDevicename,dataDeviceid); }); } =======> Result of "console.log"=="DeviceName== test" and "DeviceId==>>>> 0xdeadbeef". Function Of [...] read more
I'm trying to overrun this buffer. I ran it like this: command here, but the value is not correct. I tried various inputs with which I actually overran the buffer but instead of my expected value of the check variable 0xdeadbeef the value is something like this: 0x73737373. What am [...] read more
I want to unit test a class that reads data from a stream in a certain protocol. This will require different read() Methods on the stream in a certain order. Is there a way to mock the stream like this: MyClass readFrom(InputStream in) { byte b = in.readByte(); int c [...] read more
I want to build a microservice that uses jrpc2 and mongodb to manage small IoT devices. These are the libraries in question: https://godoc.org/bitbucket.org/creachadair/jrpc2 https://godoc.org/github.com/globalsign/mgo The problem is, being rather new to Golang in general, I'm not sure how to combine these things together. Here's the code I have: func DeviceAdd(ctx [...] read more
I am using a CSV file to inject data into my test. [TestMethod] [DataSource( CsvData, CsvDir + "TC177023.csv", "TC177023#csv", SEQ )] The file looks somethings like this: (other strings removed) something,something,Value,something,something,something ,,0xDEADBEEF,, ,,-12,, ,,0,, ,,0,, ,,0,, I have one column that I have integers in and I wanted to extend [...] read more
I am extremely confused about the exact series of steps involved in having the CPU write a value into a PCIe card's memory. It's very difficult to understand the precise meaning of stuff you read on the internet, so I'm hoping someone can read my theory of what's happening and [...] read more
I have the following C source file, hello.c, compiled on linux via g++ -o hello hello.c: #include <stdio.h> const char* p = "Hello world"; const long nn = 0xDEADBEEF; int main() { printf("%s %ld", p, nn); return -1; } (Yes I know I am using g++ for C but that [...] read more
Context I am creating a Bitfield class that is responsible for providing access to a contiguous set of bits in a UInt32. The source data is not managed by the Bitfield, but instead another object. In practice, the same object that owns the source data will also own any Bitfield [...] read more
I want to do the same repetitive job in gdb across a bunch of different files. Namely, bash$ gdb ./file1 ... gdb starts up ... gdb$ b *0xdeadbeef gdb$ r < file2 ... some output prints ... gdb$ x/3a $esp ... some addresses print ... Is there some way I [...] read more
I wrote a program to find endianness of a system. It doesnt work as the pointer value is 0xffffffef instead of 0xef. Why is the pointer value 0xffffffef? I declared it as a char* which should take only 1 byte. I can fix the problem by *ptr&0xff but I don't [...] read more
I'm new to Protobuf and would like to know if there is a good pattern for creating protobuf messages that results in readable code. You can do it like this: message.mutable_foo()->mutable_bar()->mutable_gazoo->set_gronk(4711); message.mutable_foo()->mutable_bar()->mutable_gazoo->set_grunk(0xdeadbeef); message.mutable_foo()->mutable_bar()->mutable_spunk->set_snafu("Boink!"); Or like this: auto foo = message.mutable_foo(); auto bar = foo->mutable_bar(); auto gazoo = bar->mutable_gazoo(); gazoo->set_gronk(4711); gazoo->set_grunk(0xdeadbeef); [...] read more
I have a PCI-e hardware device that has a number of registers that I want to read from and write to. However, when I read a register, I will get a value from a previous read (the first read returns 0xFFFFFFFF). I'm using pci_iomap() to get the base address of [...] read more
I've been working with a lot of assembly, and reviewing virtual memory I've run into some new confusion. Briefly, I don't understand how an address in assembly, the code that interfaces with the processor directly, could be converted from a virtual address to a physical address. I was always told [...] read more
I'm entering the DFU mode of the STM32 without using the Boot0 physical pin. I do this by sending a command via the UART and switch the uC to DFU mode. I'm using the STM32F042G6U6. But it doesn't restart when I use the ST tools to exit from DFU mode. [...] read more
I'm trying to perform a bufferoverflow so that a variable (type) has a specific value in it. I struggle with the strlen & check for my input. I tried using something like: 'AAAAA\x00AAA...A\x00\xbc\xd4\xb9' for tricking the strlen check that my input is just 5 A's long. But something strips my [...] read more
I have a snippet of C code unsigned int x = 0xDEADBEEF; unsigned short y = 0xFFFF; signed int z = -1; if (x > (signed short) y) printf("Hello"); if (x > z) printf("World"); I wanted to know if the comparison in the first statement evaluates to DEADBEEF > FFFFFFFF [...] read more
Let's say I built a vivado Zynq FPGA project, and I want to write and read the Zynq's "M_AXI_GP0" port from a c-program running on the zynq as follows. Further, let's suppose the address I want to read and write on the "M_AXI_GP0" port of the Zynq is address "0x000A1000". [...] read more
I'm running some tests on AIX, and I'm getting a bunch of crashes similar to the following: build 25-May-2019 18:40:46 Segmentation fault in ThreadSafeSharedObject_cpp::ChangeRefCount(unsigned int&,int) at line 21 in file "" ($t8) build 25-May-2019 18:40:46 Thread $t1 build 25-May-2019 18:40:46 glinkl.pthread_mutex_unlock() at 0xd5d4baac build 25-May-2019 18:40:46 BlockingResponseQueue.Simba::Support::CriticalSection::Leave() const(0x2055a320), line 54 [...] read more
Whats the best inter-process communication for a C++ DLL that's injected into a third-party process and a C# application? Here's the current situation: // This gets executed within the target process memory region LRESULT CALLBACK HookProc(int code, WPARAM wParam, LPARAM lParam) { if (code > 0) { auto csharpApplicationFunctionPointerAddress = [...] read more
I wrote this code and found that it acts differently with different versions of gcc. The source code, #include<stdio.h> int *fun(); int main(int argc, char *argv[]) { int *ptr; ptr = fun(); printf("%x", *ptr); } int *fun() { int *ptr; int foo = 0xdeadbeef; ptr = &foo; return ptr; } [...] read more
I wanna know whether a hex number "0xDEADBEEF" is a 32-bit signed number or unsigned number. Because a 32-bit singed number ranges from -2,147,483,648 - 2,147,483,647 but it is 3,735,928,559 so anyone know about this? read more
I am trying to interface TFT display with an Arduino board I am using this 2.8’ TFT display https://robu.in/product/2-8-inch-spi-touch-screen-module-tft-interface-240320/. It has ILI9341 driver IC. I am getting following error while compiling the code Not used: C:\Program Files (x86)\Arduino\libraries\SPI exit status 1 stray '\221' in program I am using the following [...] read more
I'm trying to write a reusable message object that would take its properties, convert them into a delimited string (using 0x1d group seperator), put that in a char buffer, and also be able to do the reverse (from char back to object). This reason why I must do this is [...] read more
I am trying to parse a text file with a known format, however each line is not 100% consistent. Each line of the file contains some data in the format ...x03: 0xDEADBEEF...x04: 0xDEADBEEF...x05: 0xDEADBEEF...ect I want to be able to extract particular x values from this string and print them [...] read more
I have this task: Reverse the order of an array of 32-bit integers So, I have this array: { 0x12345678, 0xdeadbeef, 0xf00df00d }; It should look like this: { 0xf00df00d, 0xdeadbeef, 0x12345678 }; I've tried this, but with no success: #include <stdint.h> void reverse_array ( uint32_t *array, unsigned int count [...] read more