v1.7.19 added Undefined Behavior to cJSON_SetValuestring()
I maintainer di solito rispondono entro 12 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Inizia dalla riga 425 di cJSON.c ed esamina il caso di test esistente a cui fa riferimento l’issue. Riproduci il comportamento con puntatori provenienti da array non correlati e verifica che la modifica completata non si basi più su confronti di puntatori non definiti, preservando al contempo il comportamento previsto di cJSON_SetValuestring().
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is incorrect C: https://github.com/DaveGamble/cJSON/blob/12c4bf1986c288950a3d06da757109a6aa1ece38/cJSON.c#L425
The C17 standard (6.5.8.5) says this about pointer comparisons:
When two pointers are compared, the result depends on the relative locations in the address space of the objects pointed to. If two pointers to object types both point to the same object, or both point one past the last element of the same array object, they compare equal. If the objects pointed to are members of the same aggregate object, pointers to structure members declared later compare greater than pointers to members declared earlier in the structure, and pointers to array elements with larger subscript values compare greater than pointers to elements of the same array with lower subscript values. All pointers to members of the same union object compare equal. If the expression P points to an element of an array object and the expression Q points to the last element of the same array object, the pointer expression Q+1 compares greater than P. In all other cases, the behavior is undefined.
In other words you can't legally determine whether or not two unrelated arrays overlap. It is only well-defined if those arrays belong to the same object. The current test case is free of UB because it happens to use pointers to addresses within the same array. That's not representative of real use.
- Lingua principale
- C
- Stelle
- 13k
- Fork
- 3.5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DaveGamble/cJSON
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DaveGamble/cJSON#1106 ·
I maintainer di solito rispondono entro 12 giorni
-
Undefined-Behavior in function cJSON_SetNumberHelperForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DaveGamble/cJSON#1100 · 1 reazione ·
I maintainer di solito rispondono entro 12 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
DaveGamble/cJSON#1094 · 9 commenti · 1 reazione ·
I maintainer di solito rispondono entro 12 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DaveGamble/cJSON#1093 ·
I maintainer di solito rispondono entro 12 giorni
-
Use-after-free in cJSONUtils_ApplyPatches when a patch removes the patch arrayForse già presa @iliasabk l’ha presa 33 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
DaveGamble/cJSON#1082 ·
I maintainer di solito rispondono entro 12 giorni
Tutte le issue di DaveGamble/cJSON
Issue simili
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
linux-test-project/ltp#1343 · 1 commento ·
-
test_audio_host: out-of-bounds read in test_audio_host_uses_exponential_full_speed_iso_intervalApertafollowup Prio 📌
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
micropython/micropython#19798 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100