Questions tagged [bytecode]
"bytecode" is a blanket term for opcodes that are consumed by a virtual machine. For example, the JVM runs bytecode stored in .class files and the CPython interpreter runs bytecode stored in .pyc files.
2,282
questions
-2
votes
2
answers
64
views
Why is there a mismatch between show bytecode and class file?
original .java file
public enum Fruit {
ORANGE(1), APPLE(2);
private final int i;
Fruit(int i){
this.i=i;
}
}
.class file
//
// Source code recreated from a .class file by ...
0
votes
1
answer
25
views
Change method implementation in Android with Byte Buddy
I want to have the implementation of some methods of Android SDK's Resources class, such as getString() use my own implementation.
I can't create my own overridden/proxy version of Resources as I get ...
-1
votes
0
answers
60
views
Inspecting reason behind SQLite: database disk image is malformed
Filling a large, but simple SQLite database occasionally we get the message
database disk image is malformed
It seems to occur frequently but at random, and resubmitting the same data seems to work. ...
1
vote
0
answers
43
views
Will PHP code work slower after obfuscation process with OPcache?
According to this scheme after launch of the code it transforms to opcode (bytecode), stores in OPcache and then execute in Zend VM (Virtual machine). And next launches will not transform code, but ...
0
votes
1
answer
63
views
How to Package a Java Agent into the Host Project?
Hellooooo, I am new to Stack Overflow,I'm clumsy when it comes to asking questions.
But I will provide additional information if the question is unclear.
This is the issue I encountered, as follows:
...
0
votes
0
answers
34
views
Why javac adds clone-method and how java separates and links methods with same signature? [duplicate]
Let's look at the following example.
public class T1 implements Cloneable {
private T1(T1 g) {}
public T1 clone() { return new T1(this); }
}
There are two clone methods in a bytecode.
$ ...
0
votes
0
answers
44
views
How to modify java bytecode after compilation using compiler plugins?
I want to modify some java classes bytecode during/after compilation phase, but before packaging, in order to use custom invokedynamic bootstrap methods.
In order to do so, I have written a Java ...
0
votes
1
answer
30
views
Finding if the current instruction is in a loop using java's asm.jar
Using https://asm.ow2.io/
I'd like to determine whether the current instruction is inside a loop.
I'm confused as to how asm does this as,
Backward Labels offsets aren't determined until you hit a ...
-1
votes
1
answer
908
views
How I can decompile byte code to .py in python 3.11
I lost my source code and tried to retrieve it again. I have extracted the cyp file and used tool to decompile it back to .py, but unfortunately, I have gotten this error:
nvalid pyc/pyo file - Magic ...
0
votes
2
answers
78
views
Understanding JVM Behavior: How Does `switch` Handle String Hash Collisions?
During an interview, I was posed an intriguing question about how the Java Virtual Machine (JVM) handles a switch statement involving a String type. Specifically, I was asked whether the JVM employs ...
0
votes
1
answer
116
views
How is string concatenation handled in Java bytecode compilation?
public class TestException extends Exception {
public TestException(String msg) {
super("This is the message: " + msg);
}
}
The above code is compiled to:
public class ...
1
vote
0
answers
50
views
How to convert assembly code from solc into EVM bytecode
I want to find a appropriate method to compile assembly code, generated from my Solidity code using "solc --asm," into EVM bytecode. I thought the the flag --assemble for solc is a correct ...
0
votes
0
answers
51
views
Sheme r1rs bytecode
I have simple tree-walking interpreter for scheme r1rs. I use Rust for it. Lisp interpreter is s-expressions interpreter, that's why i have these AST nodes:
enum SExpression<'a> {
Nil,
...
-1
votes
1
answer
166
views
Convert compiled code back into source code
I have an obfuscated Python code object that has been encoded and compressed using various modules, including base64, zlib, gzip, and marshal.
My goal is to reverse engineer this code object in order ...
1
vote
3
answers
183
views
How to compile Python code into byte code?
For example imagine I have myfile.py.
sample code:
a = 6
b = 4
print(a+b)
So how can I convert this into bytecode?
I tried this:
source_code = '''a = 6
b = 4
print(a+b)'''
compiled_code = compile(...
2
votes
0
answers
49
views
How Gas units are calculated in Smart Contracts in Ethereum
Consider the following contract written with solidity in remix.ethereum.org
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
contract Sum {
uint public sum;
...
1
vote
1
answer
43
views
If JVM is software, how does it actually compile and translate code that the machine can understand?
So "JVM compiles the source code into bytecode, and then translate it into a native machine code that the local computer understands, and with which JVM can interact with the local OS".
But ...
0
votes
1
answer
159
views
Hibernate bytecode plugin causes exception
I added hibernate bytecode plugin to my spring boot project build file because it can solve many of my n+1 query problems. however when I run the project, it crashes. I googled about it and it was ...
3
votes
0
answers
34
views
normal Python function, C extension function, ctypes C function, what are the differences?
From my understanding and question:
normal Python function is compiled into byte code, and be executed in a forever loop
C extension function is written in C by user and integrated into interpreter, ...
1
vote
2
answers
91
views
Java Bytecode Mystery: Illegal Operation Order in Constructors
I've been tinkering with reverse engineering a Java app, and I've stumbled upon something interesting. The bytecode I found seems to break the rules by not initializing the superclass first in a ...
0
votes
1
answer
47
views
Files with bytecode are really created only for imported modules?
In my system I have created a Python application that is composed by more than one file. The directory structure of the application is the following:
application_directory
|- file_a.py
|- file_b....
2
votes
1
answer
56
views
Write btytecode to file using Clojure asm library
I'm playing with Java byte-code generation using Clojure with the https://github.com/jgpc42/asm. So far so good, but now I am trying to export the generated bytecode to a .class file. With Java (code ...
1
vote
0
answers
257
views
problem with decompiling/decrypt lua file
File imagei dont know nothing about decompiling lua files, and i need help. I need to decompile this file, im trying to use luadec but i have "The input file does not have the signature of a ...
0
votes
1
answer
60
views
Difficulty profiling a Java application: Missing method in profiling results despite disabling optimizations. YourKit trivial method
Not so far ago I had been profiling an application and noticed an interesting optimization that applies to the compiled byte code.
Here is my program:
public class InstanceOnly {
public static ...
0
votes
2
answers
81
views
How to implement a bytecode scripting language with local labels and symbol linking in C, without using assembly?
I'm trying to create a bytecode scripting language in C. The language in stored in a bytecode format and consists of a command byte or opcode optionally followed by a number of parameters, with ...
1
vote
0
answers
86
views
Unit Test console output for generated bytcode
I am using https://github.com/jgpc42/insn to generate Java Bytecode, I’m trying to have some tests like bellow. The thing is that it works fine when executing with cider-test-run-ns-tests but not ...
0
votes
0
answers
78
views
How to get byte data out of string in python?
I'm having an issue with reading out data from PDFs (not really relevant I don't think). Sometimes, I get the text that I am after, but sometimes I get a long byte-string looking thing, such as: "...
1
vote
1
answer
48
views
Detect modified bytecode at runtime
There are a number of tools(e.g. JavaAssist, ASM) to re-generate bytecodes at runtime for various purposes. One case is Application permformance Management(APM), which provides agents to rewrite ...
0
votes
1
answer
117
views
Invoke a method based on argument with byte buddy
I have the following interface
public interface DatabaseClient {
void save(Entity entity, Consumer<Long> callback);
void load(long id, Consumer<Entity> callback);
}
and an ...
0
votes
1
answer
68
views
Difference between iload with '_' and without
I hava a question about the iload instruction of jasmin.
Is it correct to do iload 1 or it has to be iload_1?
Or when is a number between 1 and 3 we have to use the '' and the others we have to not ...
2
votes
2
answers
92
views
java memory management -java class loader
I am a beginner in java,for understanding java memory management i was reading book 'Java Memory Management
By Maaike van Putten , Seán Kennedy ' I encountered this statement "To be able to ...
1
vote
1
answer
126
views
How to record visited constants by MethodVisitor in ASM
I'm trying to check how many times a constant is used in the given classes. My idea is to first use ClassReader.accept(ClassVisitor, ...) to visit the class, and then declare a methodVisitor for each ...
2
votes
0
answers
371
views
Failed in nopython mode pipeline (step: analyzing bytecode)
I run this code:
from bertopic import BERTopic
bertopic_mod = BERTopic.load("bertopic_models/bertopic_complete")
I get one of the following errors (a different one each time):
IndexError: ...
2
votes
1
answer
2k
views
I'm getting an error with Uncompyle6 and Decompyle3 after getting the bytecode from pyinstxtractor
I got this error when I tried Uncompyle6 uncompyle6 main.pyc :
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen ...
1
vote
1
answer
440
views
Java ClassLoader loading class only for its own context?
I have some strange edge case behavior I want to discuss and solve with you. And as a heads-up: Please do not ask why I want to do something :)
As far as my understanding goes, the JVM loads classes ...
0
votes
1
answer
39
views
Conflict between levelspace and the profiler
I ran into a problem while trying to use the Netlogo levelspace extension and the profiler space extension in a single model. Linking an interactive model with levelspace and then trying to start the ...
0
votes
0
answers
29
views
Converting bytecodes to images in Typescript function fails for unknown reason
I am working on an Angular application; in this application, I am retrieving images as bytecodes from an API through a fileservice. I have two functions and trying to cast the bytecodes to images in ...
0
votes
1
answer
55
views
Why are my self-written classes / 3-party library classes invisible to JRE classes?
I'm writing a security-boosted Java program that uses ASM tool to add some hooks into JRE classes. The hooks will then call my method to make some rule checks. But the odd thing is, the hooks in JRE ...
0
votes
0
answers
125
views
LuaJIT 2.1 (non-existent opcodes)
LuaJIT version: 2.1.
When I try to decompile the script, I get an error. Then I saw that there are non-existent opcodes in the byte code, because of which the decompiler refuses to decompile the ...
0
votes
1
answer
329
views
different bytecode for the same smart contract
I have a smart contract called SimpleContractB
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
contract SimpleContractB {
function example1() public returns(bool, bytes memory) {
(...
0
votes
0
answers
229
views
Java ASM bytecode manipulation - add code to constructor of a library class
I have code to insert instructions into the constructor of a class from a third party library (okhttp3.OkHttpClient in this case). Disassembled class shows the added line. However, I am not sure how ...
0
votes
1
answer
189
views
Java ASM ClassReader fails with java.io.IOException: Class not found
I am trying to instrument OkHttpClient builder class. However, I am not able to create ClassReader in the first place.
import org.objectweb.asm.ClassReader;
...
// this works meaning dependency from ...
0
votes
1
answer
170
views
Making Ethereum transaction smart contarct input data in human readable
In the following tx on testnet I'm looking to understand what the bytes value being passed as an input parameter actually is in a human readable form:
Tx: https://goerli.etherscan.io/tx/...
2
votes
1
answer
155
views
Java ASM method override check
I have a problem with method override checks. I can detect simple override relations, but if the parent class has generics and the abstract method uses type parameters (return value/args), my code ...
0
votes
0
answers
34
views
Is it possible to capture the bitstream of post-interpreted code? (pre-execution) eg. speedup calls I make often
I've wondered this many times and in many cases, and I like to learn so general or close-but-more needed answers are acceptable to me.
I'll get specific, to help explain the question. Please remember ...
-1
votes
1
answer
77
views
In python on x86-64, are the first 6 arguments typically passed on registers?
To the best of my knowledge, in low level languages such as C, it is generally advisable to keep the number of arguments to functions to 6 or lower, since then there is no need to pass arguments on ...
1
vote
0
answers
507
views
AWS Lambda Python __pycache__ bytecode and local imports without layers
When creating an AWS Lambda using Python:
Can the Lambda access local imports if the modules are included in the Lambda handler zip; and
What are the implications of including the __pycache__ ...
1
vote
2
answers
116
views
Should I stop using local variables in Java?
I have these 2 codes in Java and C++, which are supposed to do the same thing.
My intuition was that the size (and also content) of object code would be the same for R1 and R2. It's the case for the C+...
0
votes
1
answer
237
views
Java ASM: Bad local variable type (dload) Type top (current frame, locals[5]) is not assignable to double
I am trying to generate Java bytecode using the Java Asm library (I am basically trying to create yet another JVM programming language)
Here is the code I am compiling
float f = 2f
float f2 = new ...
1
vote
1
answer
112
views
Implementing asynchronous programming
I'm creating a programming language (a bytecode interpreter). It has enough features already that make it useful. But now I want to implement asynchronous programming as well. I have been researching ...