stack

Android stack size

老子叫甜甜 提交于 2019-12-06 04:04:38
问题 How can i get and change the stack size (even for the main thread) of my Android application. 回答1: AFAIK -Xss can be used as a command line to change the main threads stacks size, if not using the command line the app framework will use the default size. In this case if you need more stack you will need to start a thread (using this ctor) to do the work. 回答2: The main thread stack size is set in the firmware and cannot be modified, short of modifying the firmware for your own phone. As Mr.

How to find the matching pair of braces in a string?

孤人 提交于 2019-12-06 03:19:13
问题 Suppose I have a string "(paid for) + (8 working hours) + (company rules)" . Now I want to check whether this complete string is surrounded with parentheses or not. Basically I want to check if the string is like this or not : "((paid for) + (8 working hours) + (company rules))". If it is already surrounded with parentheses, then I will leave it as it is, otherwise I will apply parentheses to the complete string so that the ouput is : "((paid for) + (8 working hours) + (company rules))" . By

Why I do get “Cannot find bound of current function” when I overwrite the ret address of a vulnerable program?

自闭症网瘾萝莉.ら 提交于 2019-12-06 03:08:37
问题 I want to exploit a stack based buffer overflow for education purposes. There is a typical function called with a parameter from main, which is given as input from the program a local buffer where the parameter is saved. Given an input such that nops+shellcode+address_shellcode , I will exploit it. After debugging with gdb I found the address of the shell code as it will pass as a parameter, and right after the strcpy I examine the stack and the $ebp+8 which is the return address has

Which versions of GCC, or flags, should I use when studying buffer overflows?

爱⌒轻易说出口 提交于 2019-12-06 02:49:17
问题 Recently, I've been studying buffer overflows as an undergraduate student in Computer Engineering. Simply out of interest, I began researching and studying buffer overflows, but have gotten stuck when attempting to implement them in my own C programs on my computer, compiled with GCC 4.9.1 (in Debian Jessie). I've heard that there are sorts of stack overflow protection in newer compilers, so I'm thinking that my issue is that my compiler version is too new. Either that, or I'm not compiling

Why can't we allocate dynamic memory on the stack?

梦想与她 提交于 2019-12-06 02:05:35
问题 Allocating stuff on the stack is awesome because than we have RAII and don't have to worry about memory leaks and such. However sometimes we must allocate on the heap: If the data is really big (recommended) - because the stack is small. If the size of the data to be allocated is only known at runtime (dynamic allocation). Two questions: Why can't we allocate dynamic memory (i.e. memory of size that is only known at runtime) on the stack? Why can we only refer to memory on the heap through

Implement stack (push, pop and findmin) in O(1)

痞子三分冷 提交于 2019-12-06 01:15:34
I have already seen two stack implementation of this question but I am really confused as how one could get O(1) operation. consider following example: S1[3542761986759] S2[3332221111111] The idea/algorithm here is Push element E on S1 Check to see if top of S2 >= E and if true, insert E on S2 But when getMin is called, we return top of S2 but that leaves S2 in weird state as S2 contains repeated current min elements, so the solution is to search next minimum element in S2 and return it. This is O(n). Can anyone please help me to understand the solution? Using a linked list store the current

Detecting that the stack is full

*爱你&永不变心* 提交于 2019-12-06 00:54:20
问题 When writing C++ code I've learned that using the stack to store memory is a good idea. But recently I ran into a problem: I had an experiment that had code that looked like this: void fun(const unsigned int N) { float data_1[N*N]; float data_2[N*N]; /* Do magic */ } The code exploted with a seqmentation fault at random, and I had no idea why. It turned out that problem was that I was trying to store things that were to big on my stack, is there a way of detecting this? Or at least detecting

Fastest way to iterate over a stack in c#

自作多情 提交于 2019-12-05 23:42:43
问题 I feel that using GetEnumerator() and casting IEnumerator.Current is expensive. Any better suggestions? I'm open to using a different data structure if it offers similiar capabilities with better performance. After thought: Would a generic stack be a better idea so that the cast isn't necessary? 回答1: Have you done any benchmarks, or are they just gut feelings? If you think that the majority of the processing time is spent looping through stacks you should benchmark it and make sure that that

how can i unstack without sorting in pandas?

自闭症网瘾萝莉.ら 提交于 2019-12-05 22:49:36
i have below time-series data couple of day.. and i wanna unstack by 'Date' it. but i used .unstack() then automatically sorted of time.. (Date/Time is multi index) Date Time a b c d e 2015-12-06 22:00:00 21.26 0 2.62 242.195 0 2015-12-06 22:15:00 21.14 0 2.55 255.516 0 2015-12-06 22:30:00 21.2 0 2.49 241.261 0 2015-12-06 22:45:00 21.18 0 2.48 232.058 0 2015-12-06 23:00:00 21.12 0 2.38 239.661 0 2015-12-06 23:15:00 21 0 2.23 228.324 0 2015-12-06 23:30:00 21.13 0 2.29 0 0 2015-12-06 23:45:00 21.12 0 2.29 0 0 2015-12-06 0:00:00 21.02 0 2.17 0 0 2015-12-06 0:15:00 21.09 0 2.13 0 0 2015-12-06 0:30

Is finding code's address in visual studio 2010 c++ using in-line assembly possible?

感情迁移 提交于 2019-12-05 22:18:46
Lets say I want to write an inline assembly function in a c++ code that returns its return address. So if I'm calling the function returnAddress() from some address and it needs to return to the address X after the function is done, I want returnAddress() to return the value X. example of code for returnAddress(): void* getAddress() { __asm { pop ebx; // moving return offset to ebx? push ebx; // restoring stack state xor eax, eax; mov ax, cs; // ax <- code segment mov ecx, 16; mul ecx; // multiplying the code segment by 16 add eax, ebx;// adding offset } } The previous code doesn't work