Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

MSP430: byte operations sign-extend into registers instead of zero-extending

Cerrado
#8,517 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start in arch/msp430/src/lift.rs and inspect the byte-handling arms, including Instruction::Mov, where the issue identifies il.sx(2, ...) as suspect. Load sx_repro.bin or use the provided printf command, then compare LLIL at offset 0 and the resulting HLIL value against the documented zero-extension behavior. Done means byte register operations produce 0x80 + arg1 rather than 0xff80 + arg1.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Arch: MSP430

Version and Platform (required):

  • Binary Ninja Version: 5.0.7648
  • Edition: Non-Commercial
  • OS: Ubuntu
  • OS Version: 24.04
  • CPU Architecture: x64

Bug Description:
A byte instruction with a register destination is lifted with a sign-extension. Per slau144 §3.2.5, Figure 3-7 (Byte-Register Operation), the high byte of the destination register is filled with 0h — byte operations zero-extend into registers.

Image

The result is an incorrect constant in HLIL for any byte value with bit 7 set.

Steps To Reproduce:
printf '\x7b\x40\x80\x00\x0f\x5b\x30\x41' > sx_repro.bin or open sx_repro.bin attached and look at sub_0 (if sub_0 does not exist, create a function at 0).

Expected Behavior:
The returned value should be 0x80 + arg1 and not 0xff80 + arg1.
LLIL at offset 0 should not sign-extend.

Confirmed against the mspdebug simulator (v0.22): with r11 = 0xdead and r15 = 0x1234 set beforehand, mov.b #0x80, r11 leaves r11 = 0x0080. The subsequent add r11, r15 gives 0x12b4.

Screenshots/Video Recording:

Image

Binary:
sx_repro.zip

Suspected cause (hypothesis):
The byte arms in arch/msp430/src/lift.rs use il.sx(2, ...) where il.zx(2, ...) is required — e.g. in Instruction::Mov:

OperandWidth::Byte => il
                    .sx(2, lift_source_operand(inst.source(), size, il))
                    .build()

This appears in several instruction arms, so the fix is likely needed in more than one place.

Lenguaje dominante
C++
Estrellas
1.3k
Forks
297
Merge medio
3 d 11 h
PR fusionados (30 d)
17

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Vector35/binaryninja-api

Todos los issues de Vector35/binaryninja-api

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.