Skip to content

Commit 34b2cb8

Browse files
authored
Merge branch 'master' into master
2 parents 541281c + 7bceab8 commit 34b2cb8

File tree

8 files changed

+115
-4
lines changed

8 files changed

+115
-4
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Automatic Dependency Submission
2+
3+
on:
4+
push:
5+
branches: [ 'master' ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
dependency-submission:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout sources
16+
uses: actions/checkout@v4
17+
- name: Setup Java
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: 'temurin'
21+
java-version: 17
22+
- name: Generate and submit dependency graph
23+
uses: gradle/actions/dependency-submission@v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The core [Termux](https://github.com/termux/termux-app) app comes with the follo
4949

5050
## Installation
5151

52-
Latest version is `v0.118.1`.
52+
Latest version is `v0.118.3`.
5353

5454
**NOTICE: It is highly recommended that you update to `v0.118.0` or higher ASAP for various bug fixes, including a critical world-readable vulnerability reported [here](https://termux.github.io/general/2022/02/15/termux-apps-vulnerability-disclosures.html). See [below](#google-play-store-experimental-branch) for information regarding Termux on Google Play.**
5555

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Check https://termux.dev/security for info on Termux security policies and how to report vulnerabilities.

jitpack.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
jdk:
2+
- openjdk11
13
env:
24
JITPACK_NDK_VERSION: "21.1.6352462"

terminal-emulator/src/main/java/com/termux/terminal/TerminalEmulator.java

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public final class TerminalEmulator {
8383
private static final int ESC_APC = 20;
8484
/** Escape processing: "ESC _" or Application Program Command (APC), followed by Escape. */
8585
private static final int ESC_APC_ESCAPE = 21;
86+
/** Escape processing: ESC [ <parameter bytes> */
87+
private static final int ESC_CSI_UNSUPPORTED_PARAMETER_BYTE = 22;
88+
/** Escape processing: ESC [ <parameter bytes> <intermediate bytes> */
89+
private static final int ESC_CSI_UNSUPPORTED_INTERMEDIATE_BYTE = 23;
8690

8791
/** The number of parameter arguments including colon separated sub-parameters. */
8892
private static final int MAX_ESCAPE_PARAMETERS = 32;
@@ -658,6 +662,10 @@ public void processCodePoint(int b) {
658662
case ESC_CSI:
659663
doCsi(b);
660664
break;
665+
case ESC_CSI_UNSUPPORTED_PARAMETER_BYTE:
666+
case ESC_CSI_UNSUPPORTED_INTERMEDIATE_BYTE:
667+
doCsiUnsupportedParameterOrIntermediateByte(b);
668+
break;
661669
case ESC_CSI_EXCLAMATION:
662670
if (b == 'p') { // Soft terminal reset (DECSTR, http://vt100.net/docs/vt510-rm/DECSTR).
663671
reset();
@@ -1059,6 +1067,37 @@ private int nextTabStop(int numTabs) {
10591067
return mRightMargin - 1;
10601068
}
10611069

1070+
/**
1071+
* Process byte while in the {@link #ESC_CSI_UNSUPPORTED_PARAMETER_BYTE} or
1072+
* {@link #ESC_CSI_UNSUPPORTED_INTERMEDIATE_BYTE} escape state.
1073+
*
1074+
* Parse unsupported parameter, intermediate and final bytes but ignore them.
1075+
*
1076+
* > For Control Sequence Introducer, ... the ESC [ is followed by
1077+
* > - any number (including none) of "parameter bytes" in the range 0x30–0x3F (ASCII 0–9:;<=>?),
1078+
* > - then by any number of "intermediate bytes" in the range 0x20–0x2F (ASCII space and !"#$%&'()*+,-./),
1079+
* > - then finally by a single "final byte" in the range 0x40–0x7E (ASCII @A–Z[\]^_`a–z{|}~).
1080+
*
1081+
* - https://en.wikipedia.org/wiki/ANSI_escape_code#Control_Sequence_Introducer_commands
1082+
* - https://invisible-island.net/xterm/ecma-48-parameter-format.html#section5.4
1083+
*/
1084+
private void doCsiUnsupportedParameterOrIntermediateByte(int b) {
1085+
if (mEscapeState == ESC_CSI_UNSUPPORTED_PARAMETER_BYTE && b >= 0x30 && b <= 0x3F) {
1086+
// Supported `0–9:;>?` or unsupported `<=` parameter byte after an
1087+
// initial unsupported parameter byte in `doCsi()`, or a sequential parameter byte.
1088+
continueSequence(ESC_CSI_UNSUPPORTED_PARAMETER_BYTE);
1089+
} else if (b >= 0x20 && b <= 0x2F) {
1090+
// Optional intermediate byte `!"#$%&'()*+,-./` after parameter or intermediate byte.
1091+
continueSequence(ESC_CSI_UNSUPPORTED_INTERMEDIATE_BYTE);
1092+
} else if (b >= 0x40 && b <= 0x7E) {
1093+
// Final byte `@A–Z[\]^_`a–z{|}~` after parameter or intermediate byte.
1094+
// Calling `unknownSequence()` would log an error with only a final byte, so ignore it for now.
1095+
finishSequence();
1096+
} else {
1097+
unknownSequence(b);
1098+
}
1099+
}
1100+
10621101
/** Process byte while in the {@link #ESC_CSI_QUESTIONMARK} escape state. */
10631102
private void doCsiQuestionMark(int b) {
10641103
switch (b) {
@@ -1656,12 +1695,16 @@ private void doCsi(int b) {
16561695
}
16571696
mCursorCol = newCol;
16581697
break;
1659-
case '?': // Esc [ ? -- start of a private mode set
1698+
case '?': // Esc [ ? -- start of a private parameter byte
16601699
continueSequence(ESC_CSI_QUESTIONMARK);
16611700
break;
1662-
case '>': // "Esc [ >" --
1701+
case '>': // "Esc [ >" -- start of a private parameter byte
16631702
continueSequence(ESC_CSI_BIGGERTHAN);
16641703
break;
1704+
case '<': // "Esc [ <" -- start of a private parameter byte
1705+
case '=': // "Esc [ =" -- start of a private parameter byte
1706+
continueSequence(ESC_CSI_UNSUPPORTED_PARAMETER_BYTE);
1707+
break;
16651708
case '`': // Horizontal position absolute (HPA - http://www.vt100.net/docs/vt510-rm/HPA).
16661709
setCursorColRespectingOriginMode(getArg0(1) - 1);
16671710
break;

termux-shared/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apply plugin: 'maven-publish'
33

44
android {
55
compileSdkVersion project.properties.compileSdkVersion.toInteger()
6+
ndkVersion = System.getenv("JITPACK_NDK_VERSION") ?: project.properties.ndkVersion
67

78
dependencies {
89
implementation "androidx.appcompat:appcompat:1.3.1"
@@ -14,7 +15,7 @@ android {
1415
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
1516
implementation "io.noties.markwon:linkify:$markwonVersion"
1617
implementation "io.noties.markwon:recycler:$markwonVersion"
17-
implementation "org.lsposed.hiddenapibypass:hiddenapibypass:5.0"
18+
implementation "org.lsposed.hiddenapibypass:hiddenapibypass:6.1"
1819

1920
// Do not increment version higher than 1.0.0-alpha09 since it will break ViewUtils and needs to be looked into
2021
// noinspection GradleDependency

termux-shared/src/main/java/com/termux/shared/models/ReportInfo.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.termux.shared.models;
22

3+
import androidx.annotation.Keep;
4+
35
import com.termux.shared.markdown.MarkdownUtils;
46
import com.termux.shared.android.AndroidUtils;
57

@@ -10,6 +12,25 @@
1012
*/
1113
public class ReportInfo implements Serializable {
1214

15+
/**
16+
* Explicitly define `serialVersionUID` to prevent exceptions on deserialization.
17+
*
18+
* Like when calling `Bundle.getSerializable()` on Android.
19+
* `android.os.BadParcelableException: Parcelable encountered IOException reading a Serializable object` (name = <class_name>)
20+
* `java.io.InvalidClassException: <class_name>; local class incompatible`
21+
*
22+
* The `@Keep` annotation is necessary to prevent the field from being removed by proguard when
23+
* app is compiled, even if its kept during library compilation.
24+
*
25+
* **See Also:**
26+
* - https://docs.oracle.com/javase/8/docs/platform/serialization/spec/version.html#a6678
27+
* - https://docs.oracle.com/javase/8/docs/platform/serialization/spec/class.html#a4100
28+
*/
29+
@Keep
30+
private static final long serialVersionUID = 1L;
31+
32+
33+
1334
/** The user action that was being processed for which the report was generated. */
1435
public final String userAction;
1536
/** The internal app component that sent the report. */

termux-shared/src/main/java/com/termux/shared/models/TextIOInfo.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.graphics.Color;
44
import android.graphics.Typeface;
55

6+
import androidx.annotation.Keep;
67
import androidx.annotation.NonNull;
78

89
import com.termux.shared.activities.TextIOActivity;
@@ -19,6 +20,25 @@
1920
*/
2021
public class TextIOInfo implements Serializable {
2122

23+
/**
24+
* Explicitly define `serialVersionUID` to prevent exceptions on deserialization.
25+
*
26+
* Like when calling `Bundle.getSerializable()` on Android.
27+
* `android.os.BadParcelableException: Parcelable encountered IOException reading a Serializable object` (name = <class_name>)
28+
* `java.io.InvalidClassException: <class_name>; local class incompatible`
29+
*
30+
* The `@Keep` annotation is necessary to prevent the field from being removed by proguard when
31+
* app is compiled, even if its kept during library compilation.
32+
*
33+
* **See Also:**
34+
* - https://docs.oracle.com/javase/8/docs/platform/serialization/spec/version.html#a6678
35+
* - https://docs.oracle.com/javase/8/docs/platform/serialization/spec/class.html#a4100
36+
*/
37+
@Keep
38+
private static final long serialVersionUID = 1L;
39+
40+
41+
2242
public static final int GENERAL_DATA_SIZE_LIMIT_IN_BYTES = 1000;
2343
public static final int LABEL_SIZE_LIMIT_IN_BYTES = 4000;
2444
public static final int TEXT_SIZE_LIMIT_IN_BYTES = 100000 - GENERAL_DATA_SIZE_LIMIT_IN_BYTES - LABEL_SIZE_LIMIT_IN_BYTES; // < 100KB

0 commit comments

Comments
 (0)